Skip to content

Golang: Convert int64 to String

I wish converting from one type to another to be much easier in golang 🙂 anyway if you want to convert an int64 into a string you can use the FormatInt function from the strconv package:

func FormatInt(i int64, base int) string

Conversion example:

package main

import (
	"fmt"
	"strconv"
)

func main() {
	myInt64 := int64(354)

	s := strconv.FormatInt(myInt64, 10)

	fmt.Println(s)
}

Leave a Reply

Your email address will not be published. Required fields are marked *