Advertisement
Guest User

Untitled

a guest
Aug 20th, 2019
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.23 KB | None | 0 0
  1. let formattedText = text
  2. .replace(/[^0-9.]/g, "") // remove chars except number, point.
  3. .replace(/(..*)./g, "$1") // remove multiple points.
  4. .replace(/^0+(d)/gm, "$1"); // remove multiple leading zeros.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement