Created
October 14, 2013 13:34
-
-
Save moklick/6975707 to your computer and use it in GitHub Desktop.
functions to enforce german number formats
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// from 1337 to 1.337 | |
function formatNumber(number){ | |
return (parseFloat(number) / 1000).toFixed(3).toString(); | |
} | |
// from 12.123 to 12,123 | |
function replacePoint(number) { | |
return number.toString().replace('.', ','); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment