--- a/sources/mystring.cpp Fri Jul 24 04:31:17 2015 +0300 +++ b/sources/mystring.cpp Sat Jan 09 17:20:25 2016 +0200 @@ -166,12 +166,9 @@ if (b == -1 or b > length()) b = length(); - if (b == a) + if (b <= a) return ""; - if (b < a) - std::swap (a, b); - if (a == 0 and b == length()) return *this; @@ -185,6 +182,16 @@ // ------------------------------------------------------------------------------------------------- // +String String::right(int length) const +{ + if (length >= this->length()) + return *this; + else + return String(chars() + this->length() - length); +} + +// ------------------------------------------------------------------------------------------------- +// int String::word_position (int n) const { int count = 0; @@ -502,4 +509,4 @@ m_string = m_string.substr (a, b - a + 1); } -END_ZFC_NAMESPACE \ No newline at end of file +END_ZFC_NAMESPACE