parseFloat (Function)
Signature: parseFloat(s: string) -> Result<float, Error>
Description: Strict finite base-10 floating-point parser. Rejects surrounding whitespace, NaN/infinity spellings, and hexadecimal floats.
Parameters
- s (
string): The string to parse
Returns: Result<float, Error>
Example
match parseFloat("3.14") {
Success { value } => print(value)
Error { message } => print(message)
}
match parseFloat "3.14"
Success value => print value
Error message => print message