Skip to content

Instantly share code, notes, and snippets.

@copyninja
Created August 13, 2013 08:30
Show Gist options
  • Save copyninja/6219050 to your computer and use it in GitHub Desktop.
Save copyninja/6219050 to your computer and use it in GitHub Desktop.
package main
import (
"fmt"
)
func main() {
normalString := "ವಾಸುದೇವ"
backquotedString := `ವಾಸುದೇವ`
fmt.Printf("Len of normalString %v \n", len(normalString))
fmt.Printf("len of backquotedString %v \n", len(backquotedString))
fmt.Println("Normal string with range operator yields following:")
for _, value := range normalString {
fmt.Printf("Unicode value: %x, rendered value: %s\n", value, string(value))
}
fmt.Println("\nBackquoted string with range operator yields following:")
for _, value := range backquotedString {
fmt.Printf("Unicode value: %x, rendered value: %s\n", value, string(value))
}
fmt.Printf("\nIndexing operation on normalString: normalString[0] \n unicode value: %x rendered value: %s\n", normalString[0], string(normalString[0]))
fmt.Printf("\nIndexing operation on backquotedString: backquotedString[0]\n unicode value: %x rendered value %s\n", backquotedString[0], string(backquotedString[0]))
fmt.Println("len(ವ)", len("ವ"))
}
@copyninja
Copy link
Author

Output of this program can be seen in this gist

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment