Issue
How do I convert into to its ASCII?
In java it’s System.out.println((char)(49)); //gives 1
I tried
a := '42'
fmt.Println(rune(a))
I get more than one character in rune literal
Solution
The reason you’re getting this error is in this variable:
a := '42'
A byte literal may only contain one character, use this instead;
a := byte(42)
Edit:
Use string(a)
to get the expected results, like boo said.
Answered By – mono
Answer Checked By – Robin (GoLangFix Admin)