Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How Can I Split a String According To Delimiters in Qt?

Tags:

qt

I am trying to split a string according to delimiter the equevelant code in C# is :

char[] delimiterChars = { ' ', ',', '.', ':', '\t' }; String[] query = sometext.Split(delimiterChars); 

but I want to do it in Qt

like image 241
Evan Lévesque Avatar asked Dec 20 '11 21:12

Evan Lévesque


1 Answers

Use split function that accepts Qt Regular Expression.

QRegExp rx("(\\ |\\,|\\.|\\:|\\t)"); //RegEx for ' ' or ',' or '.' or ':' or '\t' QStringList query = sometext.split(rx); 
like image 56
Igor Avatar answered Sep 18 '22 14:09

Igor