Contact: aviboots(AT)netvision.net.il
40,764 questions
53,140 answers
573 users
package main import ( "fmt" ) func main() { ch := 'A' hexValue := fmt.Sprintf("%x", ch) fmt.Printf("The hexadecimal value of '%c' is 0x%s", ch, hexValue); } /* run: The hexadecimal value of 'A' is 0x41 */
package main import ( "encoding/hex" "fmt" ) func main() { ch := 'A' byteValue := []byte(string(ch)) hexValue := hex.EncodeToString(byteValue) fmt.Printf("The hexadecimal value of '%c' is 0x%s", ch, hexValue); } /* run: The hexadecimal value of 'A' is 0x41 */