|
|
- package main
-
- import "fmt"
-
- func main() {
-
- username := "Sir_King_Über"
-
- // Print bytes directly
- for i := 0; i < len(username); i++ {
- fmt.Print(username[i], " ")
- }
- fmt.Printf("\n")
-
- // Print bytes converted to string
- for i := 0; i < len(username); i++ {
- fmt.Print(string(username[i]), " ")
- }
- fmt.Printf("\n")
-
- // Print bytes converted to runes
- runes := []rune(username)
- for _, value := range runes {
- fmt.Print(string(value), " ")
- }
- fmt.Printf("\n")
-
- }
|