stringToFloat()

stringToFloat( STRING string )

Don't use this yet

Unless you only need to match integers. As the examples below show, it doesn't work for floats yet.

Parameters

  • string (STRING, Required, default: none)

Returns

(FLOAT or false)

Examples

import { stringToFloat } from "@preemptivelove/utilities-js"
{ stringToFloat( "Sk8er Boi" ) } ({ typeof stringToFloat( "Sk8er Boi" ) })<br />
{ stringToFloat( "$4.00" ) } ({ typeof stringToFloat( "$4.00" ) })
8 (number)
400 (number)

Source

https://github.com/PreemptiveLove/utilities-js/blob/master/src/utilities/stringToFloat.js