We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
// pom.xml <dependency> <groupId>org.apache.commons</groupId> <artifactId>commons-lang3</artifactId> <version>3.8.1</version> </dependency> public static String defaultString(String str) { return defaultString(str, ""); } public static String defaultString(String str, String defaultStr) { return str == null ? defaultStr : str; }
public static String solution(String s) { String[] sSplit = s.split(" "); StringJoiner stringJoiner = new StringJoiner(","); for (String str : sSplit) { String firstWordToUpper = str.substring(0, 1).toUpperCase(); String otherWord = str.substring(1).toLowerCase(); stringJoiner.add(firstWordToUpper + otherWord); } return stringJoiner.toString(); } public static void main(String[] args) { String str = "3people unFollowed me"; System.out.println(solution(str)); }
3people,Unfollowed,Me
The text was updated successfully, but these errors were encountered:
No branches or pull requests
apache commons - StringUtils.defaultString()
StringJoiner(Java8 util) ... String의 join과 비슷
The text was updated successfully, but these errors were encountered: