posts - 431,  comments - 344,  trackbacks - 0
//判断是否是整数
 public static boolean isNumeric(String s)
 {
  if((s != null)&&(s!=""))
   return s.matches("^[0-9]*$");
  else
   return false;
 }
//判断传递来的是否是数字
 public static int checkID(String s)
 {
  if((s == null)||(s.length() == 0)||!s.matches("^[0-9]*$"))
  {
   return 0;
  }
  else
  {
   if(s.length() < 10)
   {
     return Integer.parseInt(s);
      }
      else
      {
        return 0;
      }
  }
 }
//判断传递来的是否是字符串
  public static String checkString(String s)
 {
  if((s == null)||(s.length() == 0)||s.matches("^[0-9]*$"))
  {
   return "";
  }
  else
  {
   return s;    
  }
 }
posted on 2006-10-18 13:34 周锐 阅读(1962) 评论(0)  编辑  收藏 所属分类: Java

只有注册用户登录后才能发表评论。


网站导航: