mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-22 23:05:36 +08:00
String utils minor improvements
This commit is contained in:
committed by
Mat Sutcliffe
parent
92d53a4077
commit
09d86aceb5
@@ -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;
|
||||
|
||||
@@ -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; });
|
||||
|
||||
Reference in New Issue
Block a user