What a best way for trimming all strings in string list? I try to use replaceInStrings:
QStringList somelist;
// ... //
// add some strings
// ... //
somelist.replaceInStrings(QRegExp("^\s*"),"");
but spaces not removed.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
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+”)