Skip to content

Instantly share code, notes, and snippets.

@joshcarp
Created April 23, 2024 13:45
Show Gist options
  • Save joshcarp/797614e2b92c2a23b9d3578908edf647 to your computer and use it in GitHub Desktop.
Save joshcarp/797614e2b92c2a23b9d3578908edf647 to your computer and use it in GitHub Desktop.
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