38 lines
651 B
Go
38 lines
651 B
Go
package main
|
|
|
|
import "fmt"
|
|
|
|
func main() {
|
|
name := "Привет"
|
|
fmt.Printf("String is %s\n",name)
|
|
|
|
fmt.Printf("Runes: ")
|
|
for i:=0; i < len(name); i++ {
|
|
fmt.Printf("%x ", name[i])
|
|
}
|
|
fmt.Println()
|
|
|
|
fmt.Printf("Bytes: ")
|
|
for i:=0; i < len(name); i++ {
|
|
fmt.Printf("%c ", name[i])
|
|
}
|
|
|
|
fmt.Println("RUnes")
|
|
|
|
runeSlice := []rune(name)
|
|
fmt.Printf("Runes: ")
|
|
for i:=0; i < len(runeSlice); i++ {
|
|
fmt.Printf("%c ", runeSlice[i])
|
|
}
|
|
fmt.Println("Bytes to runes")
|
|
for id,runeVal := range name {
|
|
fmt.Printf("%c start at position %d\n", runeVal, id)
|
|
}
|
|
|
|
word1 := "Vasya"
|
|
word2 := "Petya"
|
|
if word1 != word2 {
|
|
fmt.Println("Not equal")
|
|
}
|
|
}
|