给出一句英文句子: "let there be light" 得到一个新的字符串,每个单词的首字母都转换为大写

来源:互联网 发布:好看的动画知乎 编辑:程序博客网 时间:2024/04/29 16:42
package how2j_se;


public class TestChar {
public static void main(String args[]) {
String str = "let there be light";
String[] s = str.split(" ");
for(int i=0;i<4;i++)
{
s[i]=s[i].substring(0, 1).toUpperCase()+s[i].substring(1);
System.out.print(s[i]+' ');
}

}
}
阅读全文
0 0
原创粉丝点击