質問

This is my code:

package main
import (
    "strconv"
    "fmt"
)
func main() {
    t := strconv.Itoa64(1234)
    fmt.Println(t)
}

Problem:

Why does it cause the following error message?

command-line-arguments .\test.go:7: undefined: strconv.Itoa64 [Finished in 0.2s with exit code 2]

役に立ちましたか?

解決

This is because Itoa64 is not the name of a function in the strconv package. It looks like you really want.

t := strconv.FormatInt(1234, 10)

See http://golang.org/pkg/strconv/#FormatInt

他のヒント

You can simply convert like this

func main() {
    t := int64(1234)
    fmt.Println(t)
}
ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top