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:de.jfachwert.post.Anrede.java

/**
 * Als Ergebnis werden die einzelnen Elemente in normaler Schreibweise
 * ausgegeben und nicht in kompletter Grossschreibung.
 *
 * @return z.B. "Herr" oder "Frau"//from w w w.  ja  v a  2s  . com
 */
@Override
public String toString() {
    return StringUtils.capitalize(super.toString().toLowerCase());
}

From source file:com.spectralogic.ds3autogen.utils.Helper.java

public static String capFirst(final String str) {
    return StringUtils.capitalize(str);
}

From source file:com.skelril.skree.content.modifier.ModifierNotifier.java

@Listener
public void onPlayerJoin(ClientConnectionEvent.Join event) {
    Optional<ModifierService> optService = Sponge.getServiceManager().provide(ModifierService.class);
    if (!optService.isPresent()) {
        return;//  w w  w  .  j  a  v a  2s  .co  m
    }

    ModifierService service = optService.get();

    List<String> messages = new ArrayList<>();
    for (Map.Entry<String, Long> entry : service.getActiveModifiers().entrySet()) {
        String friendlyName = StringUtils.capitalize(entry.getKey().replace("_", " ").toLowerCase());
        String friendlyTime = PrettyText.date(entry.getValue());
        messages.add(" - " + friendlyName + " till " + friendlyTime);
    }
    if (messages.isEmpty())
        return;

    Collections.sort(messages, String.CASE_INSENSITIVE_ORDER);
    messages.add(0, "\n\nThe following donation perks are enabled:");

    Player player = event.getTargetEntity();

    Task.builder().execute(() -> {
        for (String message : messages) {
            player.sendMessage(Text.of(TextColors.GOLD, message));
        }
    }).delay(1, TimeUnit.SECONDS).submit(SkreePlugin.inst());
}

From source file:io.mapzone.controller.catalog.CatalogEntryFulltextTransformer.java

public CatalogEntryFulltextTransformer() {
    honorQueryableAnnotation.set(true);//from www  .  j  av  a  2 s . co  m
    duplicateHandler.set(DuplicateHandler.CONCAT);
    fieldNameProvider.set(prop -> {
        OGCQueryable a = (OGCQueryable) prop.info().getAnnotation(OGCQueryable.class);
        return a != null ? a.value() : StringUtils.capitalize(prop.info().getName());
    });
}

From source file:com.gammalabs.wifianalyzer.wifi.band.Country.java

Country() {
    countries = new TreeMap<>();
    for (Locale locale : Locale.getAvailableLocales()) {
        String countryCode = locale.getCountry();
        if (StringUtils.isNotEmpty(countryCode) && StringUtils.isAlpha(countryCode)
                && countryCode.length() == 2) {
            countries.put(StringUtils.capitalize(countryCode), locale);
        }//  w w w .j  a va 2s . c  o  m
    }
}

From source file:com.blackducksoftware.integration.hub.detect.help.html.HelpHtmlDataBuilder.java

public HelpHtmlDataBuilder addDetectOption(final DetectOption option) {
    final String groupName = StringUtils.capitalize(option.getDetectOptionHelp().primaryGroup);
    if (!groupsByName.containsKey(groupName)) {
        final HelpHtmlGroup group = new HelpHtmlGroup();
        group.groupName = groupName;/*from   w  w  w  .  j ava  2 s .  co  m*/
        group.options = new ArrayList<>();
        groupsByName.put(groupName, group);
    }

    final HelpHtmlGroup group = groupsByName.get(groupName);

    final HelpHtmlOption htmlOption = option.createHtmlOption();
    group.options.add(htmlOption);
    return this;
}

From source file:com.handany.base.generator.Generator.java

public static List<TableBean> getTables() {
    Properties p = new Properties();
    try {//from  www .j a  v a2  s  . c  o  m
        p.load(new FileInputStream(new File("src/main/java/com/handany/base/generator/generator.properties")));
    } catch (IOException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }

    List<TableBean> tableBeanList = jdbcTemplate.query("select * from TABLES where table_schema = ?",
            new Object[] { SCHEMA_NAME }, new RowMapper<TableBean>() {
                @Override
                public TableBean mapRow(ResultSet rs, int i) throws SQLException {
                    TableBean bean = new TableBean();
                    String tableName = rs.getString("table_name");
                    bean.setTableName(tableName);
                    bean.setTableNameNoDash(delDash(tableName));
                    bean.setTableNameCapitalized(StringUtils.capitalize(bean.getTableNameNoDash()));
                    bean.setTableComment(rs.getString("table_comment"));
                    return bean;
                }
            });

    for (TableBean tableBean : tableBeanList) {
        tableBean.setColumnBeanList(getColumns(tableBean));
    }

    return tableBeanList;
}

From source file:com.smartling.api.sdk.file.FileType.java

private static String createIdentifier(String s) {
    StringBuilder buf = new StringBuilder();
    String[] parts = s.split("_");

    for (int i = 0; i < parts.length; i++)
        buf.append((i == 0) ? parts[i].toLowerCase() : StringUtils.capitalize(parts[i].toLowerCase()));

    return buf.toString();
}

From source file:com.gammalabs.wifianalyzer.wifi.band.Country.java

Locale getCountry(@NonNull String countryCode) {
    String code = StringUtils.capitalize(countryCode);
    Locale country = countries.get(code);
    if (country == null) {
        country = new Locale("", code);
    }/* w ww  .  j  a v  a  2s .c  om*/
    return country;
}

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

/**
 * Getter./*  w w w.j a v  a  2s  .  c  om*/
 * 
 * @param target
 *            Object
 * @param propertyName
 *            ??
 * 
 * @return Object
 */
public static <T> T invokeGetterMethod(Object target, String propertyName) {
    String getterMethodName = "get" + StringUtils.capitalize(propertyName);
    return (T) invokeMethod(target, getterMethodName, new Class[] {}, new Object[] {});
}