Added: trimSeparators function to prevent trim of utf8 special chars. Currently trimSeparators only trim spaces and tabs.

--HG--
branch : compatibility-develop
hg/compatibility-develop
ulukyn 7 years ago
parent 7741d3e0c5
commit 5fcd64b537

@ -275,6 +275,20 @@ template <class T> T trimRightWhiteSpaces (const T &str)
return str.substr (0, end);
}
// remove spaces and tabs at the begin and end of the string
template <class T> T trimSeparators (const T &str)
{
typename T::size_type start = 0;
typename T::size_type size = str.size();
while (start < size && str[start] == ' ' && str[start] == '\t')
start++;
typename T::size_type end = size;
while (end > start && str[end-1] == ' ' && str[end-1] == '\t')
end--;
return str.substr (start, end-start);
}
//////////////////////////////////////////////////////////////////////////
// **** DEPRECATED *****: PLEASE DON'T USE THESE METHODS BUT FUNCTIONS ABOVE toLower() and toUpper()
//////////////////////////////////////////////////////////////////////////

Loading…
Cancel
Save