Use your imagination ;-) I use it in the following contexts: - To pass to a hex dump method to configure where the alpha chars should be in lower case or upper case. - To configure a parameterized JUnit test class to configure the case of HTTP headers and values. - To normalize input
Gary On Thu, Feb 22, 2018 at 3:14 PM, Otto Fowler <ottobackwa...@gmail.com> wrote: > What problem does it solve? > > On February 22, 2018 at 17:02:34, Gary Gregory (garydgreg...@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: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 > >