Golang convert int to string

Code examples

9
0

golang convert int to string

str := strconv.Itoa(12)
1
0

golang parse float64

f, err := strconv.ParseFloat("3.1415", 64)
1
0

go convert integer to string

s := strconv.Itoa(i)

// also
s := strconv.FormatInt(i, 10)

// and also
s := fmt.Sprintf("%d", i)
0
0

golang convert string to int64

s := "97"
n, err := strconv.ParseInt(s, 10, 64)
if err == nil {
    fmt.Printf("%d of type %T", n, n)
}
-1
0

convert string to int golang

var s string
i, err := strconv.Atoi(s)

In other languages

This page is in other languages

Русский
..................................................................................................................
Italiano
..................................................................................................................
Polski
..................................................................................................................
Română
..................................................................................................................
한국어
..................................................................................................................
हिन्दी
..................................................................................................................
Français
..................................................................................................................
Türk
..................................................................................................................
Česk
..................................................................................................................
Português
..................................................................................................................
ไทย
..................................................................................................................
中文
..................................................................................................................
Español
..................................................................................................................
Slovenský
..................................................................................................................
Балгарскі
..................................................................................................................
Íslensk
..................................................................................................................

Popular in the category

Popular pages with examples in the category