All Downloads are FREE. Search and download functionalities are using the official Maven repository.

cucumber.runtime.snippets.CamelCaseConcatenator Maven / Gradle / Ivy

There is a newer version: 1.2.6
Show newest version
package cucumber.runtime.snippets;

public class CamelCaseConcatenator implements Concatenator {
    @Override
    public String concatenate(String[] words) {
        StringBuilder functionName = new StringBuilder();
        boolean firstWord = true;
        for (String word : words) {
            if (firstWord) {
                functionName.append(word.toLowerCase());
                firstWord = false;
            } else {
                functionName.append(capitalize(word));
            }
        }
        return functionName.toString();
    }

    private String capitalize(String line) {
        return Character.toUpperCase(line.charAt(0)) + line.substring(1);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy