parse() / string()
Text ↔ number conversion.
Syntax
parse(Int, "25") // string(42)
Description
parse(Int, text) converts text to an integer, and parse(Float64, text) to a float. string(x) converts any value to text.
Example
Loading editor…
Expected output
30 42!
When to use?
Accounting for text coming from users/files.
Common mistakes
- ⚠️ parse(Int, "abc") throws an error; only numeric strings can be converted.