---
id: text-to_float
name: Text.to_float
category: text
kind: namespace-method
tokens: Text.to_float
sig: Text.to_float(s) -> float
tip: Parse a leading decimal number from a string.
order: 11
ns: Text
member: to_float
---
Reads an optional sign, the leading digits, a decimal point and an exponent from s and returns them as a float, stopping at the first character that cannot continue a number - so Text.to_float("0.25 m") is 0.25. A string with no leading number yields 0.0. It is the float twin of Text.to_int, for reading a data file or a typed value.
Parameters:
- `s` — the string to parse
```ludic
program ParseSpeed {
let typed: string = "3.2"
handler Apply phase Update {
let speed = Text.to_float(typed) # 3.2
}
}
```