[Qt-interest] [SOLVED] Multiplied spaces by QRegExp

M. Bashir Al-Noimi mbnoimi at gmx.com
Fri Apr 16 19:34:02 CEST 2010


Thanks, it's working now ;-)

On 16/04/2010 06:29 م, Julien Cugnière wrote:
> 2010/4/16 M. Bashir Al-Noimi<mbnoimi at gmx.com>:
>    
>> 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("[\" \"]+"));
>>      
> Try this : str.replace(QRegExp(" +"), " ");
>
> You could also use str.simplified(), but it doesn't keep spaces at the
> beginning and end of the string, which doesn't seem to be what you
> want.
>
>    

-- 
Best Regards
Muhammad Bashir Al-Noimi
My Blog: http://mbnoimi.net

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20100416/e08b3125/attachment.html 


More information about the Qt-interest-old mailing list