feat: add IsASCII

This commit is contained in:
dudaodong committed 2023-03-30 14:41:32 +08:00
1 parent 6453f755a6
commit e56a8a1ef5
5 files changed
+124

No files matched your search

+11
View File
@@ -58,6 +58,17 @@ func IsAllLower(str string) bool {
return str != ""
}
// IsASCII checks if string is ASCII char.
// Play:
func IsASCII(str string) bool {
for i := 0; i < len(str); i++ {
if str[i] > unicode.MaxASCII {
return false
}
}
return true
}
// ContainUpper check if the string contain at least one upper case letter A-Z.
// Play: https://go.dev/play/p/CmWeBEk27-z
func ContainUpper(str string) bool {