Example usage for org.apache.commons.lang3 StringUtils capitalize

List of usage examples for org.apache.commons.lang3 StringUtils capitalize

Introduction

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

Prototype

public static String capitalize(final String str) 

Source Link

Document

Capitalizes a String changing the first letter to title case as per Character#toTitleCase(char) .

Usage

From source file:com.fdorigo.rmfly.jpa.entities.Judge.java

public void setLastName(String lastName) {
    this.lastName = StringUtils.capitalize(lastName.toLowerCase());
    ;
}

From source file:info.novatec.testit.livingdoc.util.NameUtils.java

public static String decapitalize(String s) {
    StringBuilder sb = new StringBuilder();
    String[] parts = s.trim().split("\\s+");

    sb.append(Introspector.decapitalize(parts[0]));
    for (int i = 1; i < parts.length; ++i) {
        sb.append(StringUtils.capitalize(Introspector.decapitalize(parts[i])));
    }//from  w w  w  . j av  a2 s.co m
    return sb.toString();
}

From source file:me.dags.creativeblock.blockpack.BlockPack.java

public String getTabName(String definitionsPath, String fileParentPath) {
    if (definitionsPath.length() >= fileParentPath.length()) {
        return "General";
    }/*  www.j  a  v  a2s .  c o  m*/
    return StringUtils.capitalize(fileParentPath.substring(definitionsPath.length() + 1));
}

From source file:cz.hobrasoft.pdfmu.operation.args.PasswordArgs.java

@Override
public void setFromNamespace(Namespace namespace) {
    assert title != null;
    assert passwordArgument != null;
    password = namespace.getString(passwordArgument.getDest());
    if (password == null) {
        // Load the password from an environment variable
        assert environmentVariableArgument != null;
        String envVar = namespace.getString(environmentVariableArgument.getDest());
        assert envVar != null; // The argument has a default value
        logger.info(String.format("%s environment variable: %s", StringUtils.capitalize(title), envVar));
        password = System.getenv(envVar);
        if (password != null) {
            logger.info(String.format("%s loaded from the environment variable %s.",
                    StringUtils.capitalize(title), envVar));
        } else {// www.  ja  v a 2s  .  c om
            logger.info(String.format("%s was not set.", StringUtils.capitalize(title)));
        }
    } else {
        logger.info(String.format("%s loaded from the command line.", StringUtils.capitalize(title)));
    }
}

From source file:com.norconex.commons.wicket.markup.html.i18n.LocaleDropDownChoice.java

public LocaleDropDownChoice(String id, IModel<Locale> model, List<Locale> supportedLocales,
        final Locale displayLocale) {
    super(id, model, new ListModel<Locale>(supportedLocales), new IChoiceRenderer<Locale>() {
        private static final long serialVersionUID = 7765914025904608599L;

        @Override//from w ww .j  a va  2  s.  c  om
        public Object getDisplayValue(Locale locale) {
            Locale textLocale = displayLocale;
            if (textLocale == null) {
                textLocale = locale;
            }
            return StringUtils.capitalize(locale.getDisplayName(locale));
        }

        @Override
        public String getIdValue(Locale locale, int index) {
            return locale.toString();
        }
    });
}

From source file:com.github.dactiv.common.utils.ReflectionUtils.java

/**
 * Setter./*from   w  w  w.  ja  v  a  2  s  .  c o  m*/
 * 
 * @param target
 *            Object
 * @param value
 *            
 * @param FieldType
 *            Setter,valueClass.
 */
public static void invokeSetterMethod(Object target, String propertyName, Object value, Class<?> FieldType) {
    Class<?> type = FieldType != null ? FieldType : value.getClass();
    String setterMethodName = "set" + StringUtils.capitalize(propertyName);
    invokeMethod(target, setterMethodName, new Class[] { type }, new Object[] { value });
}

From source file:com.zack6849.alphabot.commands.Help.java

@Override
public boolean execute(MessageEvent event) {
    String[] args = event.getMessage().split(" ");
    if (args.length == 1) {
        String header = String.format("| %s| %s| %s|", StringUtils.rightPad("Command Name", 15),
                StringUtils.rightPad("Description", 50), StringUtils.rightPad("Help", 50));
        String seperator = "+" + StringUtils.repeat('-', 16) + "+" + StringUtils.repeat('-', 51) + "+"
                + StringUtils.repeat('-', 51) + "+";
        event.getUser().send().notice(seperator);
        event.getUser().send().notice(header);
        event.getUser().send().notice(seperator);
        for (String s : CommandRegistry.commands.keySet()) {
            Command command = CommandRegistry.getCommand(s);
            event.getUser().send()//from   www  . j  a v a  2 s .co  m
                    .notice(String.format("| %s| %s| %s|", StringUtils.rightPad(command.getName(), 15),
                            StringUtils.rightPad(command.getDescription(), 50),
                            StringUtils.rightPad(command.getHelp(), 50)));
        }
        event.getUser().send().notice(seperator);
        return true;
    }
    if (args.length == 2) {
        Command command = CommandRegistry.getCommand(StringUtils.capitalize(args[1].toLowerCase()));
        if (command != null) {
            event.getUser().send().notice(String.format("Help for command: %s - %s - %s", command.getName(),
                    command.getDescription(), command.getHelp()));
        } else {
            event.getUser().send()
                    .notice("Could not find the command " + args[1] + ", are you sure you spelled it right?");
        }
        return true;
    }
    return false;
}

From source file:com.vrem.wifianalyzer.wifi.band.WiFiChannelCountryGHZ5.java

SortedSet<Integer> findChannels(@NonNull String countryCode) {
    SortedSet<Integer> results = new TreeSet<>(channels);
    SortedSet<Integer> exclude = channelsToExclude.get(StringUtils.capitalize(countryCode));
    if (exclude != null) {
        results.removeAll(exclude);/*  w w w  .  j av  a  2s .c  om*/
    }
    return results;
}

From source file:com.troyhisted.inputfield.field.InputField.java

/**
 * {@inheritDoc}/*from   w w  w  .  j  ava  2  s  .co m*/
 *
 * <p>
 * Provides additional placeholder support for the field's label using either {label} or {Label} and the
 * field's value using {value}.
 *
 */
public String getMessageText() {
    if (this.message != null) {
        return this.message.getText().replace("{label}", String.valueOf(this.label))
                .replace("{Label}", String.valueOf(StringUtils.capitalize(this.label)))
                .replace("{value}", String.valueOf(this.value));
    }
    return null;
}

From source file:com.thinkbiganalytics.alerts.rest.AlertsModel.java

public String alertTypeDisplayName(String type) {
    String part = type;//  w  ww .  j  a va2 s  .  c  o  m
    if (part.startsWith(AlertConstants.KYLO_ALERT_TYPE_PREFIX + "/alert")) {
        part = StringUtils.substringAfter(part, AlertConstants.KYLO_ALERT_TYPE_PREFIX + "/alert");
    } else if (part.startsWith(AlertConstants.KYLO_ALERT_TYPE_PREFIX)) {
        part = StringUtils.substringAfter(part, AlertConstants.KYLO_ALERT_TYPE_PREFIX);
    } else {
        int idx = StringUtils.lastOrdinalIndexOf(part, "/", 2);
        part = StringUtils.substring(part, idx);
    }
    String[] parts = part.split("/");
    return Arrays.asList(parts).stream().map(s -> StringUtils.capitalize(s)).collect(Collectors.joining(" "));
}