一個String =「這是a.line是.over」
應該站出來爲
「這是一個.line區段is.Over」
我想用串標記者兩次
-first split using"."
-second split using " " to get the first word
-then change charAt[0].toUpper
現在我沒有確定如何使用字符串標記器的輸出作爲另一個輸入?
也我可以使用分割方法來生成陣列東西我試圖
String a="this is.a good boy";
String [] dot=a.split("\\.");
while(i<dot.length)
{
String [] sp=dot[i].split(" ");
sp[0].charAt(0).toUpperCase();// what to do with this part?
你不需要t他第二次分裂使charAt [0] .toUpper(),一個修剪就足夠了。 – Pino
查看此前[answer](http://stackoverflow.com/questions/1892765/capitalize-first-char-of-each-word-in-a-string-java) – GrahamA
@ Bhaskar-問題有點不同在這裏我有一個字符串與多個句子,所以首先我想拆分句子,然後大寫這個詞..我的困惑是關於如何傳遞到第二個拆分 – kshitij