refs #710 Simple algorithms to replace several regular expressions.

This commit is contained in:
Mathew Sutcliffe
2016-08-30 04:02:00 +01:00
parent d2aa2e9c1c
commit 87eeac4e15
13 changed files with 218 additions and 57 deletions

View File

@@ -16,6 +16,16 @@
namespace BlackMisc
{
QList<QStringRef> splitLinesRefs(const QString &s)
{
return splitStringRefs(s, [](QChar c) { return c == '\n' || c == '\r'; });
}
QStringList splitLines(const QString &s)
{
return splitString(s, [](QChar c) { return c == '\n' || c == '\r'; });
}
QString boolToOnOff(bool v, bool i18n)
{
Q_UNUSED(i18n);
@@ -166,9 +176,7 @@ namespace BlackMisc
QString simplifyNameForSearch(const QString &name)
{
static const QRegularExpression reg("[^A-Z]");
const QString r = name.toUpper().remove(reg);
return r;
return removeChars(name.toUpper(), [](QChar c) { return !c.isUpper(); });
}
}