public static String camelCase2LineSeparation(String camelWord) {
Matcher matcher = Pattern.compile("([A-Z][a-z])|([a-z][A-Z])").matcher(camelWord);
StringBuffer word = new StringBuffer();
while (matcher.find()){
matcher.appendReplacement(word, matcher.group(0).replaceAll("(.$)", "_$1"));
}
matcher.appendTail(word);
return word.toString().toUpperCase();
}
public static String upperCamelCase2LineSeparation(String upperCamelWord) {
Matcher matcher = Pattern.compile("[A-Z]").matcher(upperCamelWord);
StringBuffer word = new StringBuffer();
while (matcher.find()){
matcher.appendReplacement(word, matcher.group(0).toUpperCase() + "_");
}
matcher.appendTail(word);
return word.toString().toUpperCase();
}