Mojo function
atof
atof(str_slice: StringSlice[origin]) -> Float64
Parses the given string as a floating point and returns that value.
For example, atof("2.25") returns 2.25.
This function is in the prelude, so you don't need to import it.
Args:
- str_slice (
StringSlice): A string to be parsed as a floating point.
Returns:
Float64: A floating-point value that represents the string.
Raises:
If the given string cannot be parsed as an floating-point value, for
example in atof("hi").
Was this page helpful?
Thank you! We'll create more content like this.
Thank you for helping us improve!