Move comma position JavaScript -


i'm trying move position of comma use of javascript. have managed remove parts of string needed removing. problem comma in wrong position.

the current outcome 425.00, want '42.50'

success: function(result) {    if (result != '') {       alert(" "+result+" ");    }     var discountval = result.replace(/\d/g,'');    newdiscountval = discountval.replace(7.50, '');    $("input#amount").val(discountval); } 

i grabbing database echo values combination of string , echo - numbers..

if number can divide 10

if string can this:

var ind = text.indexof('.'); text = text.replace('.', ''); text.slice(0, ind-1) + '.' + text.slice(ind-1, text.length) 

Comments

Popular posts from this blog

powershell Start-Process exit code -1073741502 when used with Credential from a windows service environment -

twig - Using Twigbridge in a Laravel 5.1 Package -

c# - LINQ join Entities from HashSet's, Join vs Dictionary vs HashSet performance -