大家好,又见面了,我是全栈君。
java
public boolean isNumeric(String str){
Pattern pattern = Pattern.compile("^-?[0-9]+\\.?[0-9]*");
Matcher isNum = pattern.matcher(str);
if( !isNum.matches() ){
return false;
}
return true;
}
def isNum(value):
try:
int(value) + 1
except:
return False
else:
return True
oracle
create or replace function func_is_number( sx in varchar) return int is
x number;
begin
x:=to_number(sx);
return 1;
exception
when others then
return 0;
end;
发布者:全栈程序员栈长,转载请注明出处:https://javaforall.cn/116272.html原文链接:https://javaforall.cn