Go 语言 转换字符串成 hex字符串(string to hex string)

Skiy 24天前 16

How to convert string to hex string in Golang

package main

import (
	"encoding/hex"
	"fmt"
)

func main() {
	str := "粤B88888"
	hx := hex.EncodeToString([]byte(str))
	fmt.Println("String to Hex Golang example")
	fmt.Println()
	fmt.Println(str + " ==> " + hx)
}
Show:
String to Hex Golang example

粤B88888 ==> e7b2a4423838383838
最新回复 (0)
返回
发新帖