MCPcopy Create free account
hub / github.com/MengMengCode/GetRealityDomain / getIntInput

Function getIntInput

main.go:507–517  ·  view source on GitHub ↗

获取整数输入

()

Source from the content-addressed store, hash-verified

505
506// 获取整数输入
507func getIntInput() int {
508 reader := bufio.NewReader(os.Stdin)
509 for {
510 input, _ := reader.ReadString('\n')
511 input = strings.TrimSpace(input)
512 if num, err := strconv.Atoi(input); err == nil {
513 return num
514 }
515 fmt.Print("请输入有效的数字: ")
516 }
517}
518
519// 获取字符串输入
520func getStringInput() string {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected