How can I split QString by numbers of characters ?
Example:
I've got QString with 1000 characters and I want to split it to QStringList or QList<QString> by 200 chars per line?
How can I split QString by numbers of characters ?
Example:
I've got QString with 1000 characters and I want to split it to QStringList or QList<QString> by 200 chars per line?
how about using remove(0,200) and adding this to a QStringList in a loop?
Or you could insert a separator every 200 chars and then call QString::split on that.
but what if QString will be 983 length ? It won't fit to 200.. That's why I need good, fast and easy way to split it...
dude come on...
your question was:
shouldn't be too hard to make it work for all cases but I'm not gonna write the code for you.I've got QString with 1000 characters and I want to split it to QStringList or QList<QString> by 200 chars per line?
btw Qt Documentation for QString::remove() mentions:
If the specified position index is within the string, but position + n is beyond the end of the string, the string is truncated at the specified position.
Last edited by schnitzel; 19th March 2011 at 19:27. Reason: updated contents
Bookmarks