Say i have a Qstring of the following
QString str1 = "HelloWorldThere";
How would i go about extracting the characters from index 2 all the way to index 7 within the string so i can effectively retrieve this sing.
Qstring extractedString = "lloWor";
Pretty much i just want to extract a string from within a string when i have a starting index and an ending index. Any help is greatly appreciated
QString y = str1.mid(1, 6);
I think QRegExp class can help you:
"QRegExp Class Reference":http://qt-project.org/doc/qt-4.8/qregexp.html
QRegExp is worthless for this situation. Please try not to confuse users with random answers that are vaguely related. poporacer suggests the right approach.
[quote author="poporacer" date="1332042095"] QString y = str1.mid(1, 6);[/quote]
This is the right approach, but it should be:
@ QString y = str1.mid(2, 6);@