Example usage for org.apache.commons.lang WordUtils capitalizeFully

List of usage examples for org.apache.commons.lang WordUtils capitalizeFully

Introduction

In this page you can find the example usage for org.apache.commons.lang WordUtils capitalizeFully.

Prototype

public static String capitalizeFully(String str, char[] delimiters) 

Source Link

Document

Converts all the delimiter separated words in a String into capitalized words, that is each word is made up of a titlecase character and then a series of lowercase characters.

Usage

From source file:org.gbif.portal.web.tag.CapitalizeAllTag.java

/**
 * @see javax.servlet.jsp.tagext.TagSupport#doEndTag()
 *///from  w  ww. java2s  . c om
@Override
public int doEndTag() throws JspException {

    String string2Capitalize = this.bodyContent.getString();
    if (StringUtils.isNotEmpty(string2Capitalize)) {
        try {
            string2Capitalize = string2Capitalize.trim();
            string2Capitalize = string2Capitalize.toLowerCase();
            pageContext.getOut().print(WordUtils.capitalizeFully(string2Capitalize, ignores));
        } catch (IOException e) {
            throw new JspException(e);
        }
    }
    return super.doEndTag();
}

From source file:org.hspconsortium.cwf.api.patientlist.PatientListUtil.java

public static String formatName(String name) {
    if (StringUtils.isEmpty(name)) {
        return "";
    }/*w  ww  . ja v  a  2  s . c o m*/

    String pcs[] = StrUtil.split(WordUtils.capitalizeFully(name, WORD_DELIMITERS), ",");
    StringBuilder sb = new StringBuilder(name.length() + 5);

    for (String pc : pcs) {
        if (sb.length() > 0) {
            sb.append(", ");
        }

        sb.append(pc.trim());
    }

    return sb.toString();
}

From source file:org.openhab.binding.plugwise.internal.PlugwiseUtils.java

public static String upperUnderscoreToLowerCamel(String text) {
    String upperCamel = StringUtils.remove(WordUtils.capitalizeFully(text, new char[] { '_' }), "_");
    return upperCamel.substring(0, 1).toLowerCase() + upperCamel.substring(1);
}

From source file:org.openregistry.core.aspect.LastNameAspect.java

@Around("set(@org.openregistry.core.domain.normalization.LastName * *)")
public Object transformFieldValue(final ProceedingJoinPoint joinPoint) throws Throwable {
    final String value = (String) joinPoint.getArgs()[0];

    if (isDisabled() || value == null || value.isEmpty()) {
        return joinPoint.proceed();
    }//  w w w. j  av a2s .  co m

    final String overrideValue = getCustomMapping().get(value);

    if (overrideValue != null) {
        return joinPoint.proceed(new Object[] { overrideValue });
    }

    if (StringUtils.containsAny(value, delimiters)) {

        final String casifyValue = WordUtils.capitalizeFully(value, delimiters);

        if (casifyValue.startsWith("Mc") && casifyValue.length() > 2) {
            return joinPoint.proceed(
                    new Object[] { "Mc" + WordUtils.capitalizeFully(casifyValue.substring(2), delimiters) });

        }

        return joinPoint.proceed(new Object[] { casifyValue });
    } else {
        final String casifyValue = WordUtils.capitalizeFully(value);

        if (casifyValue.startsWith("Mc") && casifyValue.length() > 2) {
            return joinPoint
                    .proceed(new Object[] { "Mc" + WordUtils.capitalizeFully(casifyValue.substring(2)) });

        }

        return joinPoint.proceed(new Object[] { casifyValue });

    }
}