Hi , I am so green at android this is my first programming line, but it
seems to me you should simply add the following line at the end of the
sequence:
editTextInputDataTemp = editTextInputDataTemp.replaceAll(" ", " ");
which'll effectively strip the double spaces you've added yourself :)
Why did you put the double escape in the string? what does that do?
wouldn't something like this work just as well?
editTextInputDataTemp = editTextInputDataTemp.replaceAll("+", " + ");
On Tuesday, November 6, 2012 2:49:26 PM UTC+1, Solo wrote:
>
> 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("\\)", " )
>> ");
>>
> }
>>
>
>
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en