0

I am trying achieve following situation in my code but so far no luck. (For scientific calculator)

When user type = 123456 + sin(123456)

I want to display with comma separate like = 123,456 + sin(123,456)

and then I will store to single string above output.

edit = I am using edit text in android studio. I already know number format method but problem is when string contains character like (+ or sin( etc ).

I am trying to split string in to string array and then number and character store in different array list. Then add comma to number and after that join string array in one string and show to user. Like showing above.

This is like when you type in calculator app. when user type number or character app show comma in numbers before output.

Damian Yerrick
  • 4,602
  • 2
  • 26
  • 64
  • 4
    Does this answer your question? [How to Automatically add thousand separators as number is input in EditText](https://stackoverflow.com/questions/12338445/how-to-automatically-add-thousand-separators-as-number-is-input-in-edittext) – MarsAtomic May 23 '21 at 03:55
  • 2
    @Goion OP didn't specify, but it would be reasonable to assume he's using an Android TextView, which won't display formatting when passed a Java formatted number, so the TextWatcher solution in the second duplicate recommendation is probably the better course of action. – MarsAtomic May 23 '21 at 03:57

0 Answers0