How to convert hexadecimal string to decimal int in Go

1 Answer

0 votes
package main

import (
	"fmt"
	"strconv"
	"reflect"
)

func main() {
	s := "3AC5" // HEX
	i, err :=  strconv.ParseInt(s, 16, 64)
	
	fmt.Println("DEC", i, err, reflect.TypeOf(i))
}





/*
run:
  
DEC 15045 <nil> int64
  
*/

 



answered Oct 19, 2021 by avibootz

Related questions

1 answer 89 views
1 answer 191 views
3 answers 275 views
1 answer 244 views
1 answer 261 views
1 answer 79 views
...