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

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

Introduction

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

Prototype

public static String[] splitByCharacterType(final String str) 

Source Link

Document

Splits a String by Character type as returned by java.lang.Character.getType(char) .

Usage

From source file:kenh.expl.functions.SplitByCharacterType.java

public String[] process(String str, boolean camelCase) {
    if (camelCase)
        return StringUtils.splitByCharacterTypeCamelCase(str);
    else/*from  w  w  w  .j ava2 s .  co m*/
        return StringUtils.splitByCharacterType(str);
}

From source file:de.jfachwert.bank.GeldbetragFormatter.java

private Geldbetrag parse(String text) throws MonetaryParseException {
    String trimmed = new NullValidator<String>().validate(text).trim();
    String[] parts = StringUtils.splitByCharacterType(StringUtils.upperCase(trimmed));
    if (parts.length == 0) {
        throw new InvalidValueException(text, "money amount");
    }/* ww  w  .  j  a v a  2  s . co m*/
    Currency cry = Waehrung.DEFAULT_CURRENCY;
    String currencyString = findCurrencyString(parts);
    try {
        if (StringUtils.isNotEmpty(currencyString)) {
            cry = Waehrung.toCurrency(currencyString);
            trimmed = StringUtils.remove(trimmed, currencyString).trim();
        }
        BigDecimal n = new BigDecimal(new NumberValidator().validate(trimmed));
        return Geldbetrag.of(n, cry);
    } catch (IllegalArgumentException ex) {
        throw new LocalizedMonetaryParseException(text, ex);
    }
}