Skip to content

Instantly share code, notes, and snippets.

@Nikolasgrizli
Created March 19, 2019 15:48
Show Gist options
  • Save Nikolasgrizli/c47176c847cb0aa99164da2893e8b66f to your computer and use it in GitHub Desktop.
Save Nikolasgrizli/c47176c847cb0aa99164da2893e8b66f to your computer and use it in GitHub Desktop.
разделение суммы на тройки пробелами
function number_format(str) {
return str.replace(/(\s)+/g, '').replace(/(\d{1,3})(?=(?:\d{3})+$)/g, '$1 ');
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment