Example usage for org.apache.commons.lang3.text WordUtils capitalize

List of usage examples for org.apache.commons.lang3.text WordUtils capitalize

Introduction

In this page you can find the example usage for org.apache.commons.lang3.text WordUtils capitalize.

Prototype

public static String capitalize(final String str, final char... delimiters) 

Source Link

Document

Capitalizes all the delimiter separated words in a String.

Usage

From source file:com.opensource.dbhelp.dbutils.CamelBeanProcessor.java

/**
 * ?user_idUSER_ID?userId//from  w ww.  j  a v a  2s . co m
 *
 * @param name
 *            ??
 * @return ???
 */
private String formatColName(String name) {
    if (name == null || "".equals(name)) {
        return "";
    }
    String rstr = name.toLowerCase();
    rstr = WordUtils.uncapitalize(WordUtils.capitalize(rstr, "_".toCharArray()));
    rstr = rstr.replaceAll("_", "");
    return rstr;
}

From source file:com.tbodt.jswerve.Headers.java

private static String capitalizeHeader(String header) {
    return WordUtils.capitalize(header, '-');
}

From source file:au.org.ala.names.parser.PhraseNameParser.java

@Override
public <T> ParsedName<T> parse(String scientificName) throws UnparsableException {
    ParsedName pn = super.parse(scientificName);
    if (pn.getType() != NameType.wellformed && isPhraseRank(pn.rank) && (!pn.authorsParsed
            || pn.specificEpithet == null || SPECIES_PATTERN.matcher(pn.specificEpithet).matches())) {
        //if the rank marker is sp. and the word after the rank marker is lower case check to see if removing the marker will result is a wellformed name
        if (SPECIES_PATTERN.matcher(pn.rank).matches()) {
            Matcher m1 = POTENTIAL_SPECIES_PATTERN.matcher(scientificName);
            //System.out.println(POTENTIAL_SPECIES_PATTERN.pattern());
            if (m1.find()) {
                //now reparse without the rankMarker
                String newName = m1.group(1) + m1.group(3) + StringUtils.defaultString(m1.group(4), "");
                pn = super.parse(newName);
                if (pn.getType() == NameType.wellformed)
                    return pn;
            }/*  w  ww  .  java2 s  .c o  m*/
        }
        //check to see if the name represents a phrase name
        Matcher m = PHRASE_PATTERN.matcher(scientificName);
        if (m.find()) {
            ALAParsedName alapn = new ALAParsedName(pn);
            alapn.setLocationPhraseDescription(StringUtils.trimToNull(m.group(3)));
            alapn.setPhraseVoucher(StringUtils.trimToNull(m.group(4)));
            alapn.setPhraseNominatingParty(StringUtils.trimToNull(m.group(5)));
            return alapn;
        }

    } else {
        //check for the situation where the subgenus was supplied without Title case.
        Matcher m = WRONG_CASE_INFRAGENERIC.matcher(scientificName);
        if (m.find()) {
            scientificName = WordUtils.capitalize(scientificName, '(');
            pn = super.parse(scientificName);
        }
    }

    return pn;
}

From source file:com.uimirror.location.DefaultLocation.java

public String getName() {
    return WordUtils.capitalize(name, ',');
}

From source file:com.impetus.ankush2.cassandra.monitor.CassandraClusterMonitor.java

private void clusterSummary(List<Datacenter> list) {
    try {//from  w ww  .ja v  a  2 s  . c o m
        Set<String> seedNodeSet = CassandraUtils.getSeedNodeSet(clusterConf, componentConfig);
        if (seedNodeSet == null || seedNodeSet.isEmpty()) {
            addAndLogError("Could not get seed nodes details");
            return;
        }
        List<Keyspace> ks = getKeyspaces();
        if (getKeyspaces() == null) {
            addAndLogError("Could not get keyspace details");
            return;
        }
        Integer upNodeCount = CassandraUtils.getUpNodeCount(list);
        String partitioner = ((String) advanceConf.get(CassandraConstants.ClusterProperties.PARTITIONER));
        Map<String, Object> clusterSummary = new LinkedHashMap<String, Object>();
        clusterSummary.put("Up Node Count", upNodeCount);
        clusterSummary.put("Down node Count", componentConfig.getNodes().size() - upNodeCount);
        clusterSummary.put("Keyspace Count", ks.size());
        clusterSummary.put(WordUtils.capitalize(CassandraConstants.ClusterProperties.SNITCH, null),
                advanceConf.get(CassandraConstants.ClusterProperties.SNITCH));
        clusterSummary.put(WordUtils.capitalize(CassandraConstants.ClusterProperties.PARTITIONER, null),
                partitioner.substring(partitioner.lastIndexOf(".") + 1));
        clusterSummary.put("Seed Nodes", StringUtils.join(seedNodeSet, ","));
        result.put(CassandraConstants.CLUSTER_SUMMARY, clusterSummary);
    } catch (Exception e) {
        addAndLogError("Could not get Cluster Summary");
    }
}

From source file:org.jboss.shrinkwrap.descriptor.metadata.codegen.CodeGen.java

public static String getPascalizeCase(final String str) {
    return WordUtils.capitalize(str, new char[] { '_', '-' }).replaceAll("_", "").replaceAll("-", "");
}

From source file:org.jsonschema2pojo.rules.NameHelper.java

public String capitalizeTrailingWords(String name) {
    char[] wordDelimiters = generationConfig.getPropertyWordDelimiters();

    if (containsAny(name, wordDelimiters)) {
        String capitalizedNodeName = WordUtils.capitalize(name, wordDelimiters);
        name = name.charAt(0) + capitalizedNodeName.substring(1);

        for (char c : wordDelimiters) {
            name = remove(name, c);//ww  w.j a  va  2s  .  c  om
        }
    }

    return name;
}

From source file:org.squashtest.tm.web.internal.helper.HyphenedStringHelper.java

/**
 * removes hyphens and camel cases the string
 * //w w  w .j a  v  a 2  s  .  c o m
 * @param hyphened
 * @return
 */
public static String hyphenedToCamelCase(String hyphened) {
    return StringUtils.remove(WordUtils.capitalize(hyphened, HYPHEN_ARRAY), '-');
}

From source file:org.structr.common.CaseHelper.java

public static String toUpperCamelCase(final String input) {
    return WordUtils.capitalize(input, new char[] { '_' }).replaceAll("_", "");
}

From source file:org.structr.common.CaseHelper.java

public static String toLowerCamelCase(final String input) {
    return input.substring(0, 1).toLowerCase()
            .concat(WordUtils.capitalize(input, new char[] { '_' }).replaceAll("_", "").substring(1));
}