I need to display a price in a format like
7
70
700
700 000
70 000
700 000
7 000 000 etc
The problem is that I receive the price from json file, so it's always a string.
What I want is to convert that price string into the desired format by RegEx.
- We invert the price
7000000 = 0000007
- We put a whitespace after 3rd character in the inverted string
000 000 7
- Then we invert the string again and get a normal price format
7 000 000
Is it possible for json data and perhaps there is a more correct way to go? Didn't find any working examples.