parseInt (Function)

Signature: parseInt(s: string) -> Result<int, Error>

Description: Strict base-10 signed-int parser. No whitespace tolerance.

Parameters

  • s (string): The string to parse

Returns: Result<int, Error>

Example

match parseInt("42") {
    Success { value } => print(value)
    Error { message } => print(message)
}
match parseInt "42"
    Success value => print value
    Error message => print message