Created
April 23, 2024 13:45
-
-
Save joshcarp/797614e2b92c2a23b9d3578908edf647 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func TestStringRange(t *testing.T) { | |
str := "¥" | |
println("len string is ", len(str)) | |
println("for _, s := range str {") | |
for _, s := range str { | |
println(s) // prints 165 | |
} | |
println("for i := 0; i < len(str); i++ {") | |
for i := 0; i < len(str); i++ { | |
println(str[i]) // prints 194 then 165 | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment