diff -r cffa2777d917 -r 8d0d1b368de0 sources/mystring.cpp --- a/sources/mystring.cpp Fri Dec 12 01:37:04 2014 +0200 +++ b/sources/mystring.cpp Sat Dec 13 04:32:15 2014 +0200 @@ -489,3 +489,23 @@ checksum[sizeof checksum - 1] = '\0'; return String (checksum); } + +// ------------------------------------------------------------------------------------------------- +// +METHOD +String::normalize (int (*filter)(int)) -> void +{ + int a = 0; + int b = length() - 1; + + while ((*filter) (m_string[a]) and a != b) + ++a; + + while ((*filter) (m_string[b]) and a != b) + --b; + + if (a == b) + m_string = ""; + else if (a != 0 or b != length() - 1) + m_string = m_string.substr (a, b - a + 1); +}