Package main works perfectly fine, but when I try to use package ascii I get: cannot run non-main package.
I need ascii pagacke. I need to get the entire ascii table and run it through IterateOverASCIIStringLiteral(sl string) and then print it in fmt.Printf"%X %c %b/n".
Do I have to write the entire ascii table manually or is there a way to slice through it and then itterateOverASCIIStringLiteral? I’m new to go and this is driving me crazy
The [1] index instructs all verbs to use the i variable. I added the %d verb to print the decimal value. I also replaced the %c verb with %q to safely escape the characters. The decimal numbers on the verbs specify the width in units of Unicode code points. You can read more about these here.
Oh wow for real. That’s a lot simpler then I tought. Thanks a lot. I have manually typed inn all the ascii. For I need to use this.
“func IterateOverASCIIStringLiteral(sl string)” But I can’t find out where to learn how to use it. When I write
func IterateOverASCIIStringLiteral(sl string)
a := ascii
for i := 0; i < len(A); i++ {
fmt.Printf"%X %c %b/n", a[i], a[i], a[i])
}
The sl becomes an unresolved refrence. Any ideas?
Thanks man. I finally understand more of golang and a little bit of coding. I managed to make all mye functions and run them in main. The output is perfect. Now I want to write a test. to see if the string I have written only contains ascii values.