regex - javascript : parse float with string prefix in both start and end -


how convert string float? want result 900.50

case-1: var convertthis = 'any string here 900,50 string here';

case-2: var convertthis = 'any string here 900.50 string here';

how this?

var myfloat = +(convertthis.match(/\d+[,\.]?\d+/)[0].replace(",","."))


Comments

Popular posts from this blog

matlab - Deleting rows with specific rules -

jquery - How would i go about shortening this code? And to cancel the previous click on click of new section? -