Skip to content
Go

strconv API Reference

Go strconv package — conversions between strings and basic types.

By EZ4Code Team

strconv

Package strconv implements conversions to and from string representations of basic types.

strconv.Atoi(s string) (int, error)

Convert string to int. Returns error if s is not a valid integer.

Returns: (int, error)

strconv.Itoa(i int) string

Convert int to its decimal string representation.

Returns: string

strconv.ParseFloat(s string, bitSize int) (float64, error)

Convert string to a floating-point number with the precision specified by bitSize (32 or 64).

Returns: (float64, error)

strconv.ParseInt(s string, base int, bitSize int) (int64, error)

Convert string in the given base (0, 2..36) to a signed integer.

Returns: (int64, error)

strconv.FormatFloat(f float64, fmt byte, prec, bitSize int) string

Convert float to string. fmt is one of 'b','e','E','f','g','G','x','X'.

Returns: string

strconv.FormatInt(i int64, base int) string

Convert int64 to string in the given base (2..36).

Returns: string

More Go API References