Revision: 35605
Updated Code
at November 10, 2010 22:54 by stryju
Updated Code
(/[\d.]+/).exec((__PROVIDE_STRING_TO_PARSE__).replace(",", ".")) // if u want it to make even more dumb-proof ( like multiple dots/comas "within" the number ) use this: (/[\d]+.?[\d]+/).exec((__PROVIDE_STRING_TO_PARSE__).replace(",", "."))
Revision: 35604
Updated Code
at November 10, 2010 22:38 by stryju
Updated Code
(/[\d.]+/).exec((__PROVIDE_STRING_TO_PARSE__).replace(",", "."))
Revision: 35603
Updated Code
at November 10, 2010 22:38 by stryju
Updated Code
(/[\d.]+/).exec((__VALUE_GOES_HERE__).replace(",", "."))
Revision: 35602
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at November 10, 2010 22:36 by stryju
Initial Code
(/[\d.]+/).exec((__VALUE_GOES_HERE__).replace(",", ".")
Initial URL
Initial Description
it parses given string and returns 1st number it encounters ( it will replace comas with dots so floats formatted as 12,345 could be 12.345 ( some countries use that ) ) then u can parse returned value as a number / float / int - do what You need with it ;-)
Initial Title
get 1st float ( or int ) from given string
Initial Tags
regex, javascript, js, number
Initial Language
JavaScript