How to replace a comma with a dot in TypeScript

2 Answers

0 votes
let str = '9,649,137,091';

str = str.replaceAll(',', '.');

console.log(str); 
  


  
/*
run:
  
"9.649.137.091" 
  
*/

 



answered May 21, 2022 by avibootz
0 votes
let str = '9,649,137,091';

str = str.replace(/,/g, '.')

console.log(str); 
  


  
/*
run:
  
"9.649.137.091" 
  
*/

 



answered May 21, 2022 by avibootz

Related questions

1 answer 123 views
1 answer 114 views
1 answer 113 views
2 answers 138 views
2 answers 132 views
1 answer 140 views
...