Java String Camel Case To camelCasePrefix(String strPrefix)

Here you can find the source of camelCasePrefix(String strPrefix)

Description

camel Case Prefix

License

Apache License

Declaration

private static String camelCasePrefix(String strPrefix) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

public class Main {
    private static String camelCasePrefix(String strPrefix) {
        StringBuilder sb = new StringBuilder();
        for (int i = strPrefix.length() - 1; i >= 0; i--) {
            char c = strPrefix.charAt(i);
            sb.insert(0, c);//www .  j  av  a 2s  . c  o m
            if (i != 0 && Character.isUpperCase(c)) {
                // Each uppercase char in the prefix match all but uppercase chars preceding it e.g.,
                // "AcT" matches any string starting with "Ac" followed by any number of non-uppercase chars followed by "T".
                // It's the same as the regex "Ac[^A-Z]*T"
                sb.insert(0, "[^A-Z]#");
            }
        }
        return sb.toString();
    }
}

Related

  1. camelCase2Delimiter(String name, char delimiter)
  2. camelCaseIt(String mappingName, String separator)
  3. camelCaseMatch(String word, String abbr)
  4. camelCaseNameToConstant(String camelCaseName)
  5. camelCaseOrSpaceToDashed(String s)
  6. camelCaseSpace(final String str)
  7. camelCaseToDash(String input)
  8. camelCaseToDashes(String camelCaseString, int startIndex, String prefix)
  9. camelCaseToDashLowerName(String name)