Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
GoLang : String to Int64 Conversion
package main
import (
"fmt"
"strconv"
)
func main() {
str := "12345"
// String to Int64 conversation => strconv.ParseInt function return int64 with error if any.
// strconv.ParseInt() => function convert string to int64
int64I, err := strconv.ParseInt(str, 10, 64)
if err == nil{
fmt.Println(int64I)
}else{
fmt.Println(err)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment