forked from qt-creator/qt-creator
QmlDesigner: Simplyfy trimNonAsciifromFront
Use STL instead of QRegularExpression. Change-Id: I30396160706dc86aa6bbf82635681e8938a65352 Reviewed-by: Vikas Pachdha <vikas.pachdha@qt.io>
This commit is contained in:
@@ -40,11 +40,11 @@ QString filterInvalidLettersAndCapitalizeAfterInvalidLetter(QStringView id)
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
void trimNonAsciifromFront(QString &str)
|
void trimNonAsciifromFront(QString &text)
|
||||||
{
|
{
|
||||||
static const QRegularExpression lettersRegEx("[a-zA-Z]");
|
auto found = std::ranges::find_if(text, isAsciiLetter);
|
||||||
const int letterIndex = str.indexOf(lettersRegEx);
|
|
||||||
str = letterIndex == -1 ? QString() : str.sliced(letterIndex).trimmed();
|
text.erase(text.begin(), found);
|
||||||
}
|
}
|
||||||
|
|
||||||
void lowerFirstLetter(QString &id)
|
void lowerFirstLetter(QString &id)
|
||||||
|
Reference in New Issue
Block a user