码迷,mamicode.com
首页 > 数据库 > 详细

java python oracle推断字符串是否为数字的函数

时间:2016-01-18 16:07:04      阅读:181      评论:0      收藏:0      [点我收藏+]

标签:

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; 
		}

python

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;


java python oracle推断字符串是否为数字的函数

标签:

原文地址:http://www.cnblogs.com/yxwkf/p/5139540.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!