public String trans(String s, int n) {         if(s == null||s=="") return ""; String[] strs = s.split(" "); StringBuffer str = new StringBuffer(); for (int index = strs.length - 1;index >=0;index--) { str.append(strs[index]+' '); } StringBuffer result = new StringBuffer(); for(int i = 0;i < n;i++){ if(str.charAt(i)>='a'&&str.charAt(i)<='z')                  result.append(str.substring(i,i+1).toUpperCase()); else if(str.charAt(i)>='A'&&str.charAt(i)<='Z')                 result.append(str.substring(i,i+1).toLowerCase()); else if(str.charAt(i)==' ')result.append(' '); } return result.toString();     } 同问啊
点赞 评论

相关推荐

牛客网
牛客网在线编程
牛客网题解
牛客企业服务