Created
August 13, 2013 08:30
-
-
Save copyninja/6219050 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
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("ವ")) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Output of this program can be seen in this gist