Does anyone think this is useful and general enough to add to Commons Text:

/**
 * Enumerates letter cases and converts strings.
 *
 * @author <a href="mailto:ggreg...@rocketsoftware.com";>Gary Gregory</a>
 */
public enum LetterCase {
    LOWER {
        @Override
        public String toCaseString(final String source, final Locale
locale) {
            return source.toLowerCase(locale);
        }

    },
    UPPER {
        @Override
        public String toCaseString(final String source, final Locale
locale) {
            return source.toUpperCase(locale);
        }
    };

    /**
     * Converts from the given {@code source} string to the case specified
by this enum using the given {@code locale}.
     *
     * @param source
     *            the string to convert
     * @param locale
     *            the locale to use for conversion.
     * @return a converted string.
     */
    public abstract String toCaseString(String source, Locale locale);
}

?

Thank you,
Gary

Reply via email to