日期:2014-05-20  浏览次数:20832 次

字符串的翻转并大小写转换。。
输入字符串what   is   your   name?
输出Name   is   your   whaT?

------解决方案--------------------
String str= "what is your name ";
String[] strs=str.split( " "); //注意引号中间是一个空格
//这个方法依据空格把str分割一个数组
String what=strs[0];
String is=strs[1];
String your=strs[2];
String name=strs[3];
System.out.println(name.substring(0,1).toUpperCase()+name.substring(1,4)+ " "
+is+ " "+your+ " "+what.substring(0,3)+what.substring(3).toUpperCase());