From 0ad6cc0122e2f5b02b818aca76962571655ca606 Mon Sep 17 00:00:00 2001 From: AICells <1713699517@qq.com> Date: Mon, 29 Jun 2020 00:02:00 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B5=8B=E8=AF=95=E6=96=B0=E5=A2=9E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/dataType/utString.erl | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/src/dataType/utString.erl b/src/dataType/utString.erl index 66d19ad..cdbc793 100644 --- a/src/dataType/utString.erl +++ b/src/dataType/utString.erl @@ -2,8 +2,11 @@ %% API -export([ - toLowerStr/1, - toUpperStr/1 + toLowerStr/1 + , toUpperStr/1 + , isAlphaNum/1 + , isNum/1 + , isAlpha/1 ]). toLowerStr(List) when is_list(List) -> @@ -29,3 +32,16 @@ toUpperStr(List) when is_list(List) -> end || C <- List]; toUpperStr(Bin) when is_binary(Bin) -> toUpperStr(utTypeCast:toList(Bin)). + +-spec isAlpha(Char :: char()) -> boolean(). +isAlpha(Char) -> + $a =< Char andalso Char =< $z orelse $A =< Char andalso Char =< $Z. + +-spec isNum(Char :: char()) -> boolean(). +isNum(Char) -> + $0 =< Char andalso Char =< $9. + + +-spec isAlphaNum(Char :: char()) -> boolean(). +isAlphaNum(Char) -> + isAlpha(Char) orelse isNum(Char).