Created
February 17, 2015 11:45
-
-
Save Hylke1982/166a792313c5e2df9d31 to your computer and use it in GitHub Desktop.
Method to make first letter of a word capital
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 String firstLetterCapitalWithSingleSpace(final String words) { | |
return Stream.of(words.trim().split("\\s")) | |
.filter(word -> word.length() > 0) | |
.map(word -> word.substring(0, 1).toUpperCase() + word.substring(1)) | |
.collect(Collectors.joining(" ")); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment