How to remove trailing zeros from a string in TypeScript

1 Answer

0 votes
let str: string = "904841.9892000";

str = str.replace(/0+$/, '');

console.log(str);



/*
run:
 
"904841.9892" 
 
*/

 



answered Nov 15, 2024 by avibootz

Related questions

...