Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
QString - secondIndexOf
I'm trying to get the second index of a character (;) in QString, but the only voids I'm aware of are
Is there any way to find the second index of a semicolon?
For example, Qstring is: file001;15-02-2019;Accounting;Management; .
I'm trying to get the index of 2nd semicolon (the one after 2019). How is that possible?
int firstIndex = myString.index(';'); int 2ndIndex = myString.index(';',firstIndex+1);
that said, what do you want to do with the index. If you want to extract the strings between ';'
you could use
int 2ndIndex = myString.index(';',firstIndex+1);method but it's useless when you try to find 3rd , 4th and other indexes of a character.
Split is what I actually needed in my case, thank you!
sectionactually is the best way to get a section of a string which is separated by characters