How to validate special characters in QString
-
-
[quote author="Rajveer" date="1321517103"]Hi
If I do like this
@
QString str = "123345!";
int icount = str.count(QRegExp("!"));
@I get icount as 1;
But I Want to add all special characters in one regular expression and check wether the QString contains anyone of these.How to do this.[/quote]
Try this:
@
QString str = "123345!@#$%^&()_+";
int icount = str.count(QRegExp("[!@#$%^&()_+]"));
@will return 10
-
You are aware that QString supports "unicode":http://unicode.org/?
Are you sure there are no problematic characters in the non-ASCII range of the unicode table?