c++ - Adding characters to each line in a QString -
i have qstring multi-line text without space @ begining like:
lorem ispum dolor si met hulu il er
and add space each line obtain this:
lorem ispum dolor si met hulu il er
for information, use qstring of qt
you use qstring::replace()
:
qstring s = "lorem ispum\ndolor si met\nhulu il er "; s.replace(qregexp("^"), "\t");
you without regular expression :
s.insert(0, '\t'); s.replace('\n', "\n\t");
this add 1 tab (\t
) @ beginning of each line, if want add spaces, replace \t
spaces.
Comments
Post a Comment