Java String Underscore toUnderScoreCase(String s)

Here you can find the source of toUnderScoreCase(String s)

Description

to Under Score Case

License

Open Source License

Declaration

public static String toUnderScoreCase(String s) 

Method Source Code

//package com.java2s;

public class Main {

    public static String toUnderScoreCase(String s) {
        if (s == null) {
            return null;
        }/*from w  w w.j  av  a 2 s  . co  m*/
        return s.replaceAll(String.format("%s|%s|%s", "(?<=[A-Z])(?=[A-Z][a-z])", "(?<=[^A-Z])(?=[A-Z])",
                "(?<=[A-Za-z])(?=[^A-Za-z])"), "_").toLowerCase();
    }
}

Related

  1. toUnderscore(String text)
  2. toUnderscore(String v)
  3. toUnderscoreCase(final String s)
  4. toUnderscoreCase(String name)
  5. toUnderScoreCase(String s)
  6. toUnderscored(String name)
  7. toUnderscoredLowercase(String text)
  8. toUnderscoreName(String name)
  9. toUnderscores(String s)