core/src/main/java/com/twitter/elephantbird/util/Strings.java
public static String underscore(String word) {
    String firstPattern = "([A-Z]+)([A-Z][a-z])";
    String secondPattern = "([a-z\\d])([A-Z])";
    String replacementPattern = "$1_$2";
    // Replace package separator with slash.
    word = word.replaceAll("\\.", "/");
    // Replace $ with two underscores for inner classes.
    word = word.replaceAll("\\$", "__");
    // Replace capital letter with _ plus lowercase letter.
    word = word.replaceAll(firstPattern, replacementPattern);
    word = word.replaceAll(secondPattern, replacementPattern);
    word = word.replace('-', '_');
    word = word.toLowerCase();
    return word;
  }
public static String underscore(String word) {
    String firstPattern = "([A-Z]+)([A-Z][a-z])";
    String secondPattern = "([a-z\\d])([A-Z])";
    String replacementPattern = "$1_$2";
    // Replace package separator with slash.
    word = word.replaceAll("\\.", "/");
    // Replace $ with two underscores for inner classes.
    word = word.replaceAll("\\$", "__");
    // Replace capital letter with _ plus lowercase letter.
    word = word.replaceAll(firstPattern, replacementPattern);
    word = word.replaceAll(secondPattern, replacementPattern);
    word = word.replace('-', '_');
    word = word.toLowerCase();
    return word;
  }
public static String underscore ( String word ) { String firstPattern = "([A-Z]+)([A-Z][a-z])" ; String secondPattern = "([a-z\\d])([A-Z])" ; String replacementPattern = "$1_$2" ; // Replace package separator with slash. word = word . replaceAll ( "\\." , "/" ) ; // Replace $ with two underscores for inner classes. word = word . replaceAll ( "\\$" , "__" ) ; // Replace capital letter with _ plus lowercase letter. word = word . replaceAll ( firstPattern , replacementPattern ) ; word = word . replaceAll ( secondPattern , replacementPattern ) ; word = word . replace ( ' ' , ' ' ) ; word = word . toLowerCase ( ) ; return word ; }
Underscore the given word.
@param word The word
@return The underscored version of the word
Underscore the given word .