Answer the question
In order to leave comments, you need to log in
How to split a string into separate arrays?
I have this code.
QRegExp rx("(\\\n|\\:|\\;)");
QString myString("[email protected];pass\[email protected];pass2\[email protected]:pass3");
QStringList myStringList = myString.split(rx);
for (int index = 0; index < myStringList.length(); index++)
{
std::cout << "[" << index << "] " << myStringList.at(index).toStdString() << std::endl;
}
[0][1] [email protected]
[0][2] pass
[1][1] [email protected]
[1][2] pass2
Answer the question
In order to leave comments, you need to log in
I don’t know how it is in C ++, but if these are algorithms, then in javascipt it would be like this
var str = "[email protected];pass\[email protected];pass2\[email protected]:pass3"
var arr = str.split("\n").map(function(x){return x.split(/;|:/)})
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question