Skip to content

Instantly share code, notes, and snippets.

@tbonemalone
Created March 24, 2012 19:49
Show Gist options
  • Save tbonemalone/2187257 to your computer and use it in GitHub Desktop.
Save tbonemalone/2187257 to your computer and use it in GitHub Desktop.
javascript: remove commas from string of numbers
// simple remove commas from string of numbers
str.replace(/,?\s/, "");
@ali-master
Copy link

Hi Dear,

I think that's right 💯

str.replace(/,\s?/g, "");

@msureshmewara
Copy link

It is not work,
str.replace(/,\s?/g, "");

@me-kranthi
Copy link

how to remove comma from $2,000,000.00 > expecting like $2000000.00

@kyawkyawsoezhu
Copy link

how to remove comma from $2,000,000.00 > expecting like $2000000.00

'$2,000,000.00'.replace(/,/g, '')

@kawshar798
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment