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 -

php - MySQLi multi_query results for later use -