diff -r ec5387e121fa -r 146825d63b9a sources/mystring.cpp --- a/sources/mystring.cpp Wed Dec 10 19:26:13 2014 +0200 +++ b/sources/mystring.cpp Thu Dec 11 05:58:55 2014 +0200 @@ -34,7 +34,7 @@ #include "format.h" // ------------------------------------------------------------------------------------------------- - +// METHOD String::compare (const String& other) const -> int { @@ -42,7 +42,7 @@ } // ------------------------------------------------------------------------------------------------- - +// METHOD String::trim (int n) -> void { @@ -53,7 +53,7 @@ } // ------------------------------------------------------------------------------------------------- - +// METHOD String::strip (const List& unwanted) -> String { @@ -69,7 +69,7 @@ } // ------------------------------------------------------------------------------------------------- - +// METHOD String::to_uppercase() const -> String { @@ -85,7 +85,7 @@ } // ------------------------------------------------------------------------------------------------- - +// METHOD String::to_lowercase() const -> String { @@ -101,7 +101,7 @@ } // ------------------------------------------------------------------------------------------------- - +// METHOD String::split (char del) const -> StringList { @@ -111,7 +111,7 @@ } // ------------------------------------------------------------------------------------------------- - +// METHOD String::split (const String& del) const -> StringList { @@ -138,7 +138,7 @@ } // ------------------------------------------------------------------------------------------------- - +// METHOD String::replace (const char* a, const char* b) -> void { @@ -149,7 +149,7 @@ } // ------------------------------------------------------------------------------------------------- - +// METHOD String::count (char needle) const -> int { @@ -163,7 +163,7 @@ } // ------------------------------------------------------------------------------------------------- - +// METHOD String::mid (long a, long b) const -> String { @@ -188,7 +188,7 @@ } // ------------------------------------------------------------------------------------------------- - +// METHOD String::word_position (int n) const -> int { @@ -196,10 +196,7 @@ for (int i = 0; i < length(); ++i) { - if (m_string[i] != ' ') - continue; - - if (++count < n) + if (not isspace (m_string[i]) or ++count < n) continue; return i; @@ -209,7 +206,7 @@ } // ------------------------------------------------------------------------------------------------- - +// METHOD String::find (const char* c, int a) const -> int { @@ -222,7 +219,7 @@ } // ------------------------------------------------------------------------------------------------- - +// METHOD String::find_last (const char* c, int a) const -> int { @@ -237,7 +234,7 @@ } // ------------------------------------------------------------------------------------------------- - +// METHOD String::to_int (bool* ok, int base) const -> long { @@ -252,7 +249,7 @@ } // ------------------------------------------------------------------------------------------------- - +// METHOD String::to_float (bool* ok) const -> float { @@ -267,7 +264,7 @@ } // ------------------------------------------------------------------------------------------------- - +// METHOD String::to_double (bool* ok) const -> double { @@ -282,7 +279,7 @@ } // ------------------------------------------------------------------------------------------------- - +// METHOD String::operator+ (const String& data) const -> String { @@ -292,7 +289,7 @@ } // ------------------------------------------------------------------------------------------------- - +// METHOD String::operator+ (const char* data) const -> String { @@ -302,7 +299,7 @@ } // ------------------------------------------------------------------------------------------------- - +// METHOD String::is_numeric() const -> bool { @@ -333,7 +330,7 @@ } // ------------------------------------------------------------------------------------------------- - +// METHOD String::ends_with (const String& other) -> bool { @@ -345,7 +342,7 @@ } // ------------------------------------------------------------------------------------------------- - +// METHOD String::starts_with (const String& other) -> bool { @@ -356,7 +353,7 @@ } // ------------------------------------------------------------------------------------------------- - +// METHOD String::sprintf (const char* fmtstr, ...) -> void { @@ -375,7 +372,7 @@ } // ------------------------------------------------------------------------------------------------- - +// METHOD StringList::join (const String& delim) -> String { @@ -393,7 +390,7 @@ } // ------------------------------------------------------------------------------------------------- - +// METHOD String::mask_against (const String& pattern) const -> bool { @@ -442,7 +439,7 @@ } // ------------------------------------------------------------------------------------------------- - +// METHOD String::from_number (int a) -> String { @@ -452,7 +449,7 @@ } // ------------------------------------------------------------------------------------------------- - +// METHOD String::from_number (long a) -> String { @@ -462,7 +459,7 @@ } // ------------------------------------------------------------------------------------------------- - +// METHOD String::from_number (unsigned long a) -> String { @@ -472,7 +469,7 @@ } // ------------------------------------------------------------------------------------------------- - +// METHOD String::from_number (double a) -> String {