Guest User

Untitled

a guest
May 27th, 2018
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.62 KB | None | 0 0
  1. var nokMoney = function(v){
  2. v = (Math.round((v-0)*100))/100;
  3. v = (v == Math.floor(v)) ? v + ".00" : ((v*10 == Math.floor(v*10)) ? v + "0" : v);
  4. v = String(v);
  5. var ps = v.split('.');
  6. var whole = ps[0];
  7. var sub = ps[1] ? '.'+ ps[1] : '.00';
  8. var r = /(\d+)(\d{3})/;
  9. //while (r.test(whole)) {
  10. // whole = whole.replace(r, '$1' + ',' + '$2');
  11. //}
  12. v = whole + sub;
  13. if(v.charAt(0) == '-'){
  14. return 'Kr -' + v.substr(1);
  15. }
  16. return "Kr " + v;
  17. };
Add Comment
Please, Sign In to add comment