Please modify the java script for number in indian number format
-
hi.. check the following code.. <script type="text/javascript"> var indMoney = function (v) { v = (Math.round((v - 0) * 100)) / 100; v = (v == Math.floor(v)) ? v + ".00" : ((v * 10 == Math.floor(v * 10)) ? v + "0" : v); v = String(v); var ps = v.split('.'), whole = ps[0], sub = ps[1] ? '.' + ps[1] : '.00', r = /(\d+)(\d{3})/; while (r.test(whole)) { whole = whole.replace(r, '$1' + ',' + '$2'); } v = whole + sub; return v; } </script> The result of the above function is displaying like this 123,123,123.00 but i want in this format 12,31,23,123.00 i.e indian currency format..
-
hi.. check the following code.. <script type="text/javascript"> var indMoney = function (v) { v = (Math.round((v - 0) * 100)) / 100; v = (v == Math.floor(v)) ? v + ".00" : ((v * 10 == Math.floor(v * 10)) ? v + "0" : v); v = String(v); var ps = v.split('.'), whole = ps[0], sub = ps[1] ? '.' + ps[1] : '.00', r = /(\d+)(\d{3})/; while (r.test(whole)) { whole = whole.replace(r, '$1' + ',' + '$2'); } v = whole + sub; return v; } </script> The result of the above function is displaying like this 123,123,123.00 but i want in this format 12,31,23,123.00 i.e indian currency format..
-
hi.. check the following code.. <script type="text/javascript"> var indMoney = function (v) { v = (Math.round((v - 0) * 100)) / 100; v = (v == Math.floor(v)) ? v + ".00" : ((v * 10 == Math.floor(v * 10)) ? v + "0" : v); v = String(v); var ps = v.split('.'), whole = ps[0], sub = ps[1] ? '.' + ps[1] : '.00', r = /(\d+)(\d{3})/; while (r.test(whole)) { whole = whole.replace(r, '$1' + ',' + '$2'); } v = whole + sub; return v; } </script> The result of the above function is displaying like this 123,123,123.00 but i want in this format 12,31,23,123.00 i.e indian currency format..
You posted the same question in Questions section. Refer to http://www.codeproject.com/Questions/162106/Please-modify-the-java-script-for-number-in-indian.aspx[^]
-
This is the Java forum, Javascript is next one down.
I must get a clever new signature for 2011.
More than that he has asked the same question in the Questions section too...lol
-
hi.. check the following code.. <script type="text/javascript"> var indMoney = function (v) { v = (Math.round((v - 0) * 100)) / 100; v = (v == Math.floor(v)) ? v + ".00" : ((v * 10 == Math.floor(v * 10)) ? v + "0" : v); v = String(v); var ps = v.split('.'), whole = ps[0], sub = ps[1] ? '.' + ps[1] : '.00', r = /(\d+)(\d{3})/; while (r.test(whole)) { whole = whole.replace(r, '$1' + ',' + '$2'); } v = whole + sub; return v; } </script> The result of the above function is displaying like this 123,123,123.00 but i want in this format 12,31,23,123.00 i.e indian currency format..
-
WTF - damn, you indian programmers like to get penalized - ain't ya! NumberFormat @ Oracle JavaDoc[^] That's how we do it in Java - pretty simple. regards Torsten
I never finish anyth...
-
hi.. check the following code.. <script type="text/javascript"> var indMoney = function (v) { v = (Math.round((v - 0) * 100)) / 100; v = (v == Math.floor(v)) ? v + ".00" : ((v * 10 == Math.floor(v * 10)) ? v + "0" : v); v = String(v); var ps = v.split('.'), whole = ps[0], sub = ps[1] ? '.' + ps[1] : '.00', r = /(\d+)(\d{3})/; while (r.test(whole)) { whole = whole.replace(r, '$1' + ',' + '$2'); } v = whole + sub; return v; } </script> The result of the above function is displaying like this 123,123,123.00 but i want in this format 12,31,23,123.00 i.e indian currency format..
You should put your code in code block by using "pre" tag it makes readability of code. and next I am suggesting you as same as Richard suggest you should move your question to there-[JavaScript Forum][^] for quick response :)