Reputation: 51
I'm developing a Qt application. I have some Strings like :
(Sub String before @)
[email protected]
[email protected]
I want to use
43243263
325754754
How to do that?
Upvotes: 3
Views: 5140
Reputation: 29285
You can use QString::indexOf
and QString::mid
methods to extract the desired part.
QString str = "[email protected]";
QString desired = str.mid(0, str.indexOf("@"));
Upvotes: 7
Reputation: 5821
I will assume you have QString
.
QStringList partsList = yourString.split('@');
// your check here the length of list is 2
Your desired output QString
will be at:
partsList.at(0)
Upvotes: 1