Converting int to string

Hi, I’m sure that you can guess that I’m a noob from my name.
I seem to have a problem with converting stuff; here’s my code:

package main
import “fmt”
func main(){
i := 12
fmt.Printf("%s",string(i))
}

I expected it to print 12, but it just prints an empty line. I really don’t know what’s going on.

Take a look at the strconv package.

https://golang.org/pkg/strconv/

1 Like

Will do, thanks!

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.