Data types and Type Conversion
Last updated
Was this helpful?
Last updated
Was this helpful?
bool, int, float, byte, rune, string, constants, structs, slice, array, and map
Type conversion
int to string
string to int
float to string
string to float
characters and rune
Conversion Type
method
differences (if any)
Example
int to string
strconv.Itoa
not a standard but most common use
fmt.Sprintf
not as good as Itoa
string to int
strconv.Atoi
returns 0 is string is empty, or first character isnt number or a minu sign and returns the number formed up until that point
Important: write about fmt from