awk 如何判断一个字符串是否为纯数字?
3个回答
展开全部
char c;
...
判断每个字符是否是
c>='0' && c<='9'
...
判断每个字符是否是
c>='0' && c<='9'
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
2011-12-16
展开全部
pl/sql中:
CREATE OR REPLACE FUNCTION CHAR_NUMBER(P_CHAR VARCHAR2) RETURN VARCHAR2
IS
P_RETURN VARCHAR2(50);
P_MOD NUMBER;
BEGIN
SELECT MOD(P_CHAR,2)
INTO P_MOD
FROM DUAL;
IF P_MOD=1 OR P_MOD=0 THEN
P_RETURN :=P_CHAR||' IS NUMBER';
RETURN P_RETURN;
END IF ;
EXCEPTION
WHEN OTHERS THEN
P_RETURN :=P_CHAR||' IS CHAR';
RETURN P_RETURN;
END CHAR_NUMBER;
测试:
SELECT CHAR_NUMBER('TT3TT') AS P_TYPE
FROM DUAL;
CREATE OR REPLACE FUNCTION CHAR_NUMBER(P_CHAR VARCHAR2) RETURN VARCHAR2
IS
P_RETURN VARCHAR2(50);
P_MOD NUMBER;
BEGIN
SELECT MOD(P_CHAR,2)
INTO P_MOD
FROM DUAL;
IF P_MOD=1 OR P_MOD=0 THEN
P_RETURN :=P_CHAR||' IS NUMBER';
RETURN P_RETURN;
END IF ;
EXCEPTION
WHEN OTHERS THEN
P_RETURN :=P_CHAR||' IS CHAR';
RETURN P_RETURN;
END CHAR_NUMBER;
测试:
SELECT CHAR_NUMBER('TT3TT') AS P_TYPE
FROM DUAL;
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询