strconv
String conversion functions from the Go standard library.
Functions
atoi
Function signature
atoi(s string) intConverts the string s to an int.
Example
>>> strconv.atoi("123")
123
>>> strconv.atoi("nope")
strconv.Atoi: parsing "nope": invalid syntaxparse_bool
Function signature
parse_bool(s string) boolConverts the string s to a bool.
Example
>>> strconv.parse_bool("true")
true
>>> strconv.parse_bool("false")
false
>>> strconv.parse_bool("nope")
strconv.ParseBool: parsing "nope": invalid syntaxparse_float
Function signature
parse_float(s string) floatConverts the string s to a float.
Example
>>> strconv.parse_float("3.14")
3.14
>>> strconv.parse_float("nope")
strconv.ParseFloat: parsing "nope": invalid syntaxparse_int
Function signature
parse_int(s string, base int = 10, bit_size int = 64) intConverts the string s to an int.
Example
>>> strconv.parse_int("123")
123
>>> strconv.parse_int("nope")
strconv.ParseInt: parsing "nope": invalid syntax
>>> strconv.parse_int("ff", 16)
255