Golang – Convert an integer to string

To convert an integer to a string with Golang, the Google programming language, you must use the Itoa function of the strconv package.

Here is an example:

package main

import (
    "fmt"   
    "strconv"    
    )
    
func main() {
    
    mystring := "foo"
    myinteger := 1
    
    fmt.Println(mystring + strconv.Itoa(myinteger))
    
}

Leave a Comment

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