Mojo function
atof
atof(str_slice: StringSlice[origin]) -> SIMD[float64, 1]
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[origin]
): A string to be parsed as a floating point.
Returns:
An floating point value that represents the string, or otherwise raises.
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!