mcuw mcuw - 9 months ago 130
C++ Question

QStringList remove spaces from strings

What a best way for trimming all strings in string list? I try to use replaceInStrings:

QStringList somelist;
// ... //
// add some strings
// ... //

but spaces not removed.

Answer Source

As another answer already told, you need to escape the backslash. You also want to change the expression to match one or more spaces and not 0 or more spaces, try using: QRegExp("^\\s+")