Split QString with split index
qstring, qt
Solution
If I understand your question correctly, you could use the `left` and `mid` methods to extract the portions of the string before and after an `offset`:
quint32 offset = 4;
QString test("PineApple");
QString before = test.left(offset); // Pine
QString after = test.mid(offset); // Apple
If you're looking to end up with a `QStringList` (as you would have if you'd used `split`), you can obtain one like so:
QStringList list;
list << before
<< after;
Problem
I need to split a qstring into two strings but knowing only the index of the splitter charachter. Here's an exaple ``` input: PineApple 3 Output: Pine // 'e' has index 3, so it is the splitter char and it belongs to the first part Apple ```