Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
How can I capture the part of my QString
I'm using qt5.5 on my computer and Linux+QT for my OS system.
I've got a string like this.
And I just need
I've seen the QString document.
I don't see any function that have this ability to do it.
How can I solve this problem?
Or any advise?
Thanks in Advanced!
If you just want to drop the last character: QString::chop
VRonin last edited by
Can't I do like this?
scan_info = scan_info.mid(19).chop(1);
I will get error when I compile.
QString str = " lots\t of\nwhitespace\r\n ";
str = str.trimmed();
// str == "lots\t of\nwhitespace"
scan_info = scan_info.chop(1);
I can do it with this one!
QString s("TWO.M TRS-M28\n"); QString removeMe("\n"); if(s.endsWith(removeMe)) s.remove(s.length()-removeMe.length(), removeMe.length());
If you'd read the documentation of the
chopmethod which also has an example, you would have seen that it modifies the string in-place.
By the way, where's that
scan_info.mid(19)coming from ?