String str1="名字" str2="1000"if(中文类型的字符)
         dosomething....
if(数字类型字符)

解决方案 »

  1.   

    String str1="名字" str2="1000"if(中文类型的字符)
      dosomething....
    if(数字类型字符)
       dosomething 有没有什么方法能实现这样的效果呀 
      

  2.   

    用正则表达式,或者使用Character.isDigit()来判断是否是数字
      

  3.   

    1、判断字符串是否为连续的中文字符(不包含英文及其他任何符号和数字):
    Regex.IsMatch("中文","^[\u4e00-\u9fa5]+$");
    2、判断字符串是否为连续数字
    Regex.IsMatch("123","^\\d+$");
      

  4.   

    /**
     * 判断字符串是否为连续的中文字符(不包含英文及其他任何符号和数字):
     * @param s
     * @return true表示是中文字符,false不是
     */
    private static boolean isCString(String s){
    return s.matches("^[\u4e00-\u9fa5]+$");
    }
    public static void main(String[] args) {
    String str1 = "中文";
    if(isCString(str1)){
    System.out.println("是中文");
    }
    }
      

  5.   

    public   class   isChinese   { 
        public   isChinese()   { 
        }     public   boolean   isChinese(char   a)   { 
            int   v   =   (int)   a; 
            return   (v   > =   19968   &&   v   <=   171941); 
        } 
    http://topic.csdn.net/t/20040923/15/3402123.html
      

  6.   

    ","^[\u4e00-\u9fa5]+$ 这行能解释下吗
      

  7.   

    如果没猜错的话就是汉字字符在Unicode值中占的范围了