Go语言十六进制转十进制

Go语言十六进制转十进制

代码Demo

import (
	"fmt"
	"strconv"
	"testing"
)

func Test_1(t *testing.T) {
	s:= "0e"
	if parseUint, err := strconv.ParseUint(s, 16, 32);err != nil {
		panic(err)
	}else{
		fmt.Println(parseUint)
	}
}

打印

=== RUN   Test_1
14
--- PASS: Test_1 (0.00s)
PASS

Process finished with exit code 0

posted @ 2020-09-23 13:15  Kingram  阅读(3851)  评论(0编辑  收藏  举报