kk
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"bufio"
|
||||
"fmt"
|
||||
"os"
|
||||
)
|
||||
|
||||
func main() {
|
||||
var name string
|
||||
input := bufio.NewScanner(os.Stdin)
|
||||
if input.Scan() { //Capture input and save into buffer. Captures until \n
|
||||
name = input.Text()
|
||||
}
|
||||
|
||||
fmt.Println(name)
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
module main.go
|
||||
|
||||
go 1.24.4
|
||||
@@ -0,0 +1,37 @@
|
||||
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")
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user