[Qt-interest] Multiplied spaces by QRegExp

Alexandre Beraud aberaud at infflux.com
Fri Apr 16 18:33:04 CEST 2010


Hi,

This regex isn't what you're looking for.
Try this: str.replace(QRegExp("\s+"), " ");

Regards,

Alex


M. Bashir Al-Noimi a écrit :
>
> Hi All,
>
> I never tried to use QRegExp before but today I want to use it for 
> manipulating text files. My procedure is so easy:
>
> *I want to remove any multiplied spaces from specific string.*
>
> For example:
>
> " This is   my  source"
> modified to:
> " This is my source"
>
> I tried to run this snippet but it didn't work! could you help me please?
>
> QString str = " This is   my  source";
> str.remove(QRegExp("[\" \"]+"));
>
>
> *PS.*
>
> I used this exp. in Lex successfully.
>
> -- 
> Best Regards
> Muhammad Bashir Al-Noimi
> My Blog: http://mbnoimi.net
>   
> ------------------------------------------------------------------------
>
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-interest
>   


-- 
Alexandre BERAUD
Ingénieur Développement

Infflux - Informatique & Flux
Tel: 01 49 57 92 00 - Fax : 01 49 57 92 01
Mail: aberaud at infflux.com
Visitez notre site :  www.infflux.com




More information about the Qt-interest-old mailing list