commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Otto Fowler <ottobackwa...@gmail.com>
Subject Re: [text] Upper/Lower case enum
Date Thu, 22 Feb 2018 22:14:24 GMT
What problem does it solve?

On February 22, 2018 at 17:02:34, Gary Gregory (garydgregory@gmail.com)
wrote:

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

/**
* Enumerates letter cases and converts strings.
*
* @author <a href="mailto:ggregory@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

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message