On 22 February 2018 at 23:15, Gary Gregory <garydgreg...@gmail.com> wrote:
> On Thu, Feb 22, 2018 at 4:11 PM, sebb <seb...@gmail.com> wrote:
>
>> On 22 February 2018 at 22:27, Gary Gregory <garydgreg...@gmail.com> wrote:
>> > Use your imagination ;-)
>>
>> What would the new code look like?

I mean the user code before and after the enum is introduced.

>>
>
> I posted the code at the start of this thread...
>
> Gary
>
>
>>
>> How does it compare with code that does not have the enum?
>>
>> > 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
>> >>
>> >>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
>> For additional commands, e-mail: dev-h...@commons.apache.org
>>
>>

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
For additional commands, e-mail: dev-h...@commons.apache.org

Reply via email to