mcuw mcuw - 7 months ago 123
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.


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+")