IrisJavaDiary
Tuesday, March 19, 2019
65. Valid Number
Version #1 Go library
10.61 %
import (
"strconv"
"strings"
)
func isNumber(s string) bool {
_, err := strconv.ParseFloat(strings.TrimSpace(s), 64)
return err == nil || strings.Contains(err.Error(), "value out of range")
}
No comments:
Post a Comment
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment