String utils minor improvements

This commit is contained in:
Klaus Basan
2020-04-11 04:46:05 +02:00
committed by Mat Sutcliffe
parent 92d53a4077
commit 09d86aceb5
2 changed files with 5 additions and 2 deletions

View File

@@ -79,6 +79,9 @@ namespace BlackMisc
if (c == '1' || c == 't' || c == 'y' || c == 'x') { return true; }
if (c == '0' || c == 'f' || c == 'n' || c == '_') { return false; }
if (c == 'e') { return true; } // enabled
if (c == 'd') { return false; } // disabled
// full words
if (s == "on") { return true; }
return false;

View File

@@ -190,13 +190,13 @@ namespace BlackMisc
return removeChars(string, [](QChar c) { return !is09(c); });
}
//! String only with 0-9
//! String only with 0-9, or separator
inline QString char09OrSeparatorOnlyString(const QString &string)
{
return removeChars(string, [](QChar c) { return !is09OrSeparator(c); });
}
//! String only with 0-9
//! String only with ASCII values
inline QString asciiOnlyString(const QString &string)
{
return removeChars(string.simplified(), [](QChar c) { return c.unicode() > 127; });