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