PDA

View Full Version : Need SpanIncluding like method in QString



rajeshs
31st October 2007, 09:58
Hi All,


Is there any method in Qt like SpanIncluding(LPCTSTR lpszCharSet ) which is in CString ?

which will extracts characters from the string, starting with the first character, which are in

the set of characters identified by lpszCharSet ?

kernel_panic
31st October 2007, 10:25
QString & QString::remove ( const QRegExp & rx )
This is an overloaded member function, provided for convenience.
Removes every occurrence of the regular expression rx in the string, and returns a reference to the string. For example:
QString r = "Telephone";
r.remove(QRegExp("[aeiou]."));
// r == "The"
See also indexOf(), lastIndexOf(), and replace().

kernel_panic
31st October 2007, 10:47
The correct copy of your function is this:


QString r = "Telephone";
r.remove(QRegExp("[^aeiou]"));
// r == "eeoe"

rajeshs
31st October 2007, 15:05
Thank you for your valuable reply