Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Removing everything after specific character

Tags:

c++

qt

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?

like image 208
Farzan Njr Avatar asked May 03 '26 12:05

Farzan Njr


1 Answers

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("@"));
like image 182
frogatto Avatar answered May 06 '26 02:05

frogatto



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!