字符串大小写转换与分割

 1 public class hello 
 2 {
 3     public static void main(String[] args)
 4     {
 5         //大小写转换
 6         String a="abcd";
 7         System.out.println(a.toUpperCase());//大写转小写
 8         System.out.println(a.toLowerCase());//小写转大写
 9        //分割
10         String b="张三#男#20岁#三班";//在字符串中添加特殊的符号
11         String[] c=b.split("#");//用split分割出来所有的信息,存在数组中
12         for(String d:c)//遍历输出
13         {
14             System.out.println(d);
15         }
16     }
17 }

 

posted @ 2016-05-14 11:06  明天会更好!!!!  阅读(196)  评论(0)    收藏  举报