Phone: +380957248791
E-mail: krukovaolga1@gmail.com
Telegram: @olgakrukova7771
Discord: OlgaKrukova(@lokispirit)
Goal: To become a java-programmer
Priorities:
Odessa National University of Technology
Management
September 1999 - June 2004 | Ukraine |
Odessa State Environmental University
Oceanology
September 2011 - June 2016 | Ukraine |
Sale Manager
September 2004 - Novenber 2011 | Ukraine |
Complete the method/function so that it converts dash/underscore delimited words into camel casing. The first word within the output should be capitalized only if the original word was capitalized (known as Upper Camel Case, also often referred to as Pascal case). The next words should be always capitalized.
public class Solution {
static String toCamelCase(String s) {
if(s==null || s.isEmpty()){
return "";
}
String[] split = s.split("[_-]");
StringBuilder builder = new StringBuilder();
builder.append(split[0]);
for (int i = 1; i < split.length; i++) {
builder.append(split[i].substring(0, 1).toUpperCase() + split[i].substring(1));
}
return builder.toString();
}
}