Skip to content

Commit

Permalink
.
Browse files Browse the repository at this point in the history
  • Loading branch information
Jrohy committed Mar 5, 2020
1 parent 5f7828c commit 9f619d2
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions util/string.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ const (
RESET = "\033[0m"
)

// IsNumber 判断字符串是否为数字
func IsNumber(input string) bool {
// IsInteger 判断字符串是否为整数
func IsInteger(input string) bool {
_, err := strconv.Atoi(input)
return err == nil
}
Expand Down Expand Up @@ -83,7 +83,7 @@ func LoopInput(tip string, choices interface{}, print bool) int {
}
if inputString == "" {
return -1
} else if !IsNumber(inputString) {
} else if !IsInteger(inputString) {
fmt.Println("输入有误,请重新输入")
continue
}
Expand Down

0 comments on commit 9f619d2

Please sign in to comment.