Skip to content

Instantly share code, notes, and snippets.

@delphinpro
Last active June 13, 2018 02:26
Show Gist options
  • Save delphinpro/50f2c7b4589502b7a69619ade522b0ca to your computer and use it in GitHub Desktop.
Save delphinpro/50f2c7b4589502b7a69619ade522b0ca to your computer and use it in GitHub Desktop.
Разбиение больших чисел на разряды
export function triplets(str) {
// \u202f — неразрывный узкий пробел
return str.toString().replace(/(\d)(?=(\d\d\d)+([^\d]|$))/g, '$1\u202f');
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment