Created
April 28, 2015 09:59
-
-
Save zaki-yama/af4a4b68864af12d4854 to your computer and use it in GitHub Desktop.
単語の先頭だけ大文字に変換するメソッド
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public static void capitalize(String str){ | |
| List<String> words = str.split(' '); // 単語に分ける | |
| List<String> capitalizedWords = new List<String>(); | |
| for (String word : words) { | |
| capitalizedWords.add(word.capitalize()); | |
| } | |
| return String.join(capitalizedWords, ' '); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment