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) 

Source Link

Document

Converts all the whitespace 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:com.nvinayshetty.DTOnator.NameConventionCommands.CamelCase.java

@Override
public String parseFieldName(String name) {
    String capitalized = name;//ww  w .  j ava2  s .c o  m
    if (name.contains(" ")) {
        capitalized = WordUtils.capitalizeFully(name);

    }
    if (name.contains("_"))
        capitalized = WordUtils.capitalizeFully(capitalized, new char[] { '_' });
    else
        capitalized = WordUtils.capitalizeFully(capitalized);
    String javaConvention = DtoHelper.firstetterToLowerCase(capitalized);
    String removedSpace = javaConvention.replaceAll(" ", "");
    return removedSpace.replaceAll("_", "");
}

From source file:com.jaspersoft.studio.data.sql.model.metadata.MTables.java

@Override
public String getDisplayText() {
    return WordUtils.capitalizeFully(getValue());
}

From source file:net.lordsofcode.zephyrus.utils.Lang.java

/**
 * Fully capitalizes the string/*w  w  w  .  jav  a  2  s  .  c  o  m*/
 * 
 * @param string
 *            The string to change
 * @return The capitalized version of that string
 */
public static String caps(String string) {
    return WordUtils.capitalizeFully(string);
}

From source file:br.com.bluesoft.pronto.model.Anexo.java

public Anexo(final String nomeCompleto) {
    this.nomeCompleto = nomeCompleto;
    nomeDoArquivo = this.nomeCompleto.substring(0, nomeCompleto.lastIndexOf('.'));
    extensao = this.nomeCompleto.substring(nomeCompleto.lastIndexOf('.') + 1);
    nomeParaExibicao = WordUtils.capitalizeFully(nomeDoArquivo.replace("_", " "));
}

From source file:com.adaptris.core.services.metadata.MetadataKeyToCapitalCase.java

@Override
protected String reformatKey(String s) throws ServiceException {
    return WordUtils.capitalizeFully(s);
}

From source file:com.ro.ssc.app.client.utils.ExcelReader.java

/**
 *
 * @param file// ww w .  j a  v  a  2  s . c  o m
 * @return
 */
public static Map<String, User> readExcel(File file) {
    Map<String, User> result = new HashMap<>();
    List<Event> events;
    try {
        POIFSFileSystem fs = new POIFSFileSystem(new FileInputStream(file));
        HSSFWorkbook wb = new HSSFWorkbook(fs);
        HSSFSheet sheet = wb.getSheetAt(0);
        HSSFRow row;
        HSSFCell cell;

        int rows; // No of rows
        rows = sheet.getPhysicalNumberOfRows();

        int cols = 0; // No of columns
        int tmp;

        // This trick ensures that we get the data properly even if it doesn't start from first few rows
        for (int i = 0; i < 10 || i < rows; i++) {
            row = sheet.getRow(i);
            if (row != null) {
                tmp = sheet.getRow(i).getPhysicalNumberOfCells();
                if (tmp > cols) {
                    cols = tmp;
                }
            }
        }

        DateTimeFormatter dtf = DateTimeFormat.forPattern("yyyy-MM-dd HH:mm:ss EEEE");
        for (int r = 1; r < rows; r++) {
            row = sheet.getRow(r);

            if (row != null) {
                try {
                    String user = WordUtils
                            .capitalizeFully(row.getCell(ExcelEnum.USER_NAME.getAsInteger()).toString().trim());
                    if (row.getCell(ExcelEnum.PASSED.getAsInteger()).toString().trim().equals("1.0")) {
                        if (result.containsKey(user)) {
                            events = result.get(user).getEvents();

                            events.add(new Event(
                                    DateTime.parse(row.getCell(ExcelEnum.TIMESTAMP.getAsInteger()).toString(),
                                            dtf),
                                    row.getCell(ExcelEnum.DESCRIPTION.getAsInteger()).toString(),
                                    row.getCell(ExcelEnum.ADDRESS.getAsInteger()).toString().trim(),
                                    row.getCell(ExcelEnum.PASSED.getAsInteger()).toString().trim()
                                            .equals("1.0")));
                            result.get(user).setEvents(events);

                        } else {
                            events = new ArrayList();
                            events.add(new Event(
                                    DateTime.parse(row.getCell(ExcelEnum.TIMESTAMP.getAsInteger()).toString(),
                                            dtf),
                                    row.getCell(ExcelEnum.DESCRIPTION.getAsInteger()).toString().trim(),
                                    row.getCell(ExcelEnum.ADDRESS.getAsInteger()).toString().trim(),
                                    row.getCell(ExcelEnum.PASSED.getAsInteger()).toString().trim()
                                            .equals("1.0")));
                            String id = row.getCell(ExcelEnum.USER_ID.getAsInteger()).toString().trim();
                            result.put(user, new User(user, id.contains(".") ? id.split("\\.")[0] : id,
                                    row.getCell(ExcelEnum.CARD_NO.getAsInteger()).toString().trim(),
                                    WordUtils.capitalizeFully(
                                            row.getCell(ExcelEnum.DEPARTMENT.getAsInteger()).toString().trim()),
                                    events));
                        }
                    }
                } catch (Exception e) {
                    log.error("Exception" + e.getMessage());
                }
            }
        }
    } catch (Exception ioe) {
        log.error("Exception" + ioe.getMessage());
    }
    return result;
}

From source file:io.kamax.mxisd.threepid.notification.PlaceholderNotificationGenerator.java

protected String populateForCommon(String input, ThreePid recipient) {
    String domainPretty = WordUtils.capitalizeFully(mxCfg.getDomain());

    return input.replace("%DOMAIN%", mxCfg.getDomain()).replace("%DOMAIN_PRETTY%", domainPretty)
            .replace("%RECIPIENT_MEDIUM%", recipient.getMedium())
            .replace("%RECIPIENT_ADDRESS%", recipient.getAddress());
}

From source file:com.senacor.wbs.web.core.EnumConverter.java

public String convertToString(Object value, Locale locale) {
    Enum enumValue = (Enum) value;
    String enumName = enumValue.name();
    String words = StringUtils.replace(enumName, "_", " ");
    return WordUtils.capitalizeFully(words);
}

From source file:com.edmunds.etm.web.util.EtmFormat.java

/**
 * Formats an enum value as a string of capitilized words.
 *
 * @param value the enum to format/*from  w w w  .j ava2s. c  om*/
 * @return formatted string
 */
public String enumeration(Enum<?> value) {
    if (value == null) {
        return getEmptyString();
    }

    String str = value.toString().replace('_', ' ');
    return str.length() > 2 ? WordUtils.capitalizeFully(str) : str;
}

From source file:de.Keyle.MyPet.skill.skills.implementation.Control.java

public void upgrade(ISkillInfo upgrade, boolean quiet) {
    if (upgrade instanceof ControlInfo) {
        if (!quiet && !active) {
            String controlItemName = WordUtils.capitalizeFully(
                    BukkitUtil.getMaterialName(CONTROL_ITEM.getItem().getTypeId()).replace("_", " "));
            myPet.sendMessageToOwner(Util.formatText(
                    Locales.getString("Message.Skill.Control.Upgrade", myPet.getOwner().getLanguage()),
                    myPet.getPetName(), controlItemName));

        }//from ww  w  .ja v a 2s.  co m
        active = true;
    }
}