Skip to content

Instantly share code, notes, and snippets.

@irshadhasmat
Created May 29, 2018 05:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save irshadhasmat/f8f317d00794310504a87515f2dc9d7b to your computer and use it in GitHub Desktop.
Save irshadhasmat/f8f317d00794310504a87515f2dc9d7b to your computer and use it in GitHub Desktop.
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