-2

I want to format my textinput value like this

1
10
100
1,000
10,000
1,00,000

how can I achieve that can anyone please tell me?

Kanwarjeet Singh
  • 722
  • 1
  • 12
  • 34

1 Answers1

0

Use Int.NumberFormat JavaScript API to format Indian Rupees values.

for eg-

const formatter = new Intl.NumberFormat('en-IN', {maximumSignificantDigits: 3 })

console.log(formatter.format(1)); 
console.log(formatter.format(10)); 

console.log(formatter.format(10000));
console.log(formatter.format(100000)); 
 
Gulam Hussain
  • 1,591
  • 10
  • 19
  • showing error ` ReferenceError: Property 'Intl' doesn't exist, js engine: hermes` – Kanwarjeet Singh Jun 23 '21 at 12:56
  • I think `Intl` javascript api is not supported in react-native. you can use polyfills https://stackoverflow.com/questions/67496051/intl-polyfills-for-react-native-0-63-and-hermes – Gulam Hussain Jun 23 '21 at 12:58