It might be better to use a meaningful regular expression.
Or you could try to first remove all whitespaces and then add one between 
each pair of non-whitespaces.
Besides, this isn't actually an Android-related question, is it?

Am Dienstag, 6. November 2012 14:49:26 UTC+1 schrieb Solo:
>
> Given a string: (1+2)*(3/4)-(5+6)
> I want to add whitespaces to it, so it becomes: ( 1 + 2 ) * ( 3 / 4 ) - ( 
> 5 + 6 )
>
> This is my function for this, but it makes double whitespaces. 
> Can anyone help me please?
>
> public void addSpaces (){
>>     editTextInputDataTemp = editTextInputDataTemp.replaceAll("\\+", " + 
>> ");
>>     editTextInputDataTemp = editTextInputDataTemp.replaceAll("\\-", " - 
>> ");
>>     editTextInputDataTemp = editTextInputDataTemp.replaceAll("\\*", " * 
>> ");
>>     editTextInputDataTemp = editTextInputDataTemp.replaceAll("\\/", " / 
>> ");
>>
>>     editTextInputDataTemp = editTextInputDataTemp.replaceAll("\\(", " ( 
>> ");
>>     editTextInputDataTemp = editTextInputDataTemp.replaceAll("\\)", " ) 
>> ");
>>
> } 
>>
>
>
-- 
[image: Facebook]<http://www.facebook.com/pages/FINARX-GmbH/159293750854154>
 [image: XING] <http://www.xing.com/companies/finarxgmbh/about>

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to