String toUpperCase() 
          Converts all of the characters in this String to upper case using the rules of the default locale.

解决方案 »

  1.   

    String toLowerCase() 
              Converts all of the characters in this String to lower case using the rules of the default locale.
      

  2.   

    不会吧!这么简单的程序还要别人写!太懒了吧!
    看在分的面子上给你写一个!不要忘了给分!
    应该还有很多好方法!
    测试通过:
     
       static String convertString(String str){
           String upStr = str.toUpperCase();
           String lowStr = str.toLowerCase();
           StringBuffer buf = new StringBuffer(str.length());       for(int i=0;i<str.length();i++){
              if(str.charAt(i) == upStr.charAt(i)){
                buf.append(lowStr.charAt(i));
              }
              else{
                buf.append(upStr.charAt(i));
              }
       }
        return buf.toString();
    }
      

  3.   

    1。看看String类吧,应该有大小写转换的.
    2.以前看人家的文章说,先提取头一个字节,如果它不在255内,哪这个字节跟下一个字节就是一个中文。单java用的是2字节表示的,怎么提取第一字节我就不知道啦!
      

  4.   

    程序2我以前写过,不过只能判断是ascii还是非ascii,仅仅是中文的话比较困难,我想应该是不能实现的!
    以下程序吧str中的非ascii挑出来,供你参考!    static String deleteAsscii(String str){
           StringBuffer buf = new StringBuffer(str.length());
           for(int i=0;i<str.length();i++){
              if(str.charAt(i) >128) {
                buf.append(str.charAt(i));
              }
       }
        return buf.toString();
    }