Корректировка

This commit is contained in:
Anatoly Prohacky 2023-01-19 09:26:50 +10:00
parent 07c8c6ffa0
commit bb6b810564
2 changed files with 25 additions and 15 deletions

Binary file not shown.

View File

@ -1,25 +1,35 @@
package util
import (
"bufio"
"fmt"
"os"
"strings"
)
// func InputTerminal(name string) string {
// fmt.Print(name + ": ")
// reader := bufio.NewReader(os.Stdin)
// ret, _ := reader.ReadString('\n')
// splitedSlice := strings.Split(ret, " ")
// if len(splitedSlice) == 1 {
// splSlice2 := strings.Split(splitedSlice[0], "\n")
// ret = splSlice2[0]
// } else {
// ret = splitedSlice[0]
// }
// retB := []byte(ret)
// fmt.Print(fmt.Sprintf("%s", retB[len(retB):]))
// if fmt.Sprintf("%s", retB[len(retB):]) == "[13]" {
// ret = fmt.Sprintf("%s", retB[:len(retB)-1])
// }
// fmt.Printf("%d\n", []byte(ret))
// return ret
// }
func InputTerminal(name string) string {
var ret string
fmt.Print(name + ": ")
reader := bufio.NewReader(os.Stdin)
ret, _ := reader.ReadString('\n')
splitedSlice := strings.Split(ret, " ")
if len(splitedSlice) == 1 {
splSlice2 := strings.Split(splitedSlice[0], "\n")
ret = splSlice2[0]
} else {
ret = splitedSlice[0]
}
fmt.Scanln(&ret)
return ret
}