1
0
mirror of https://github.com/duke-git/lancet.git synced 2026-02-09 23:22:28 +08:00

feat: add IsASCII

This commit is contained in:
dudaodong
2023-03-30 14:41:32 +08:00
parent 6453f755a6
commit e56a8a1ef5
5 changed files with 124 additions and 0 deletions

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 {