Convert Int To String Golang Code Example


Example 1: golang convert int to string


str := strconv.Itoa(12)

Example 2: go convert integer to string


s := strconv.Itoa(i)

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

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

Example 3: 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)
}

Example 4: convert string to int golang


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

Comments

Popular posts from this blog

Converting A String To Int In Groovy

"Cannot Create Cache Directory /home//.composer/cache/repo/https---packagist.org/, Or Directory Is Not Writable. Proceeding Without Cache"

Android SDK Location Should Not Contain Whitespace, As This Cause Problems With NDK Tools