[lang] Appetite for new method StringUtils.toCamelCase(String str, char delimiter, boolean capitalizeFirstLetter)

classic Classic list List threaded Threaded
13 messages Options
Reply | Threaded
Open this post in threaded view
|

[lang] Appetite for new method StringUtils.toCamelCase(String str, char delimiter, boolean capitalizeFirstLetter)

Rob Tompkins
Hello all,

Folks at my day job have a method that takes in a space delimited String (or arbitrarily delimited string for that matter), and returns a camel cased string. Is there any reason that this shouldn’t be in StringUtils? It feels reasonable to me. What are folks thoughts?

Cheers,
-Rob
---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: [lang] Appetite for new method StringUtils.toCamelCase(String str, char delimiter, boolean capitalizeFirstLetter)

garydgregory
Isn't this kind of stuff or anything camel case supposed to be in [text]
these days?

Gary

On Jun 1, 2017 7:03 AM, "Rob Tompkins" <[hidden email]> wrote:

> Hello all,
>
> Folks at my day job have a method that takes in a space delimited String
> (or arbitrarily delimited string for that matter), and returns a camel
> cased string. Is there any reason that this shouldn’t be in StringUtils? It
> feels reasonable to me. What are folks thoughts?
>
> Cheers,
> -Rob
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>
Reply | Threaded
Open this post in threaded view
|

Re: [lang] Appetite for new method StringUtils.toCamelCase(String str, char delimiter, boolean capitalizeFirstLetter)

Rob Tompkins

> On Jun 1, 2017, at 10:11 AM, Gary Gregory <[hidden email]> wrote:
>
> Isn't this kind of stuff or anything camel case supposed to be in [text]

I’m ok with that path as well. It feels like it’s on the line between the two components. Either way, it sounds like you’re not opposed to adding it to a component.

Should it be TextUtils.toCamelCase(String str, char delimiter, boolean capitalizeFirstLetter), or WordUtils maybe, if we were to put it in [text]?

-Rob

> these days?
>
> Gary
>
> On Jun 1, 2017 7:03 AM, "Rob Tompkins" <[hidden email]> wrote:
>
>> Hello all,
>>
>> Folks at my day job have a method that takes in a space delimited String
>> (or arbitrarily delimited string for that matter), and returns a camel
>> cased string. Is there any reason that this shouldn’t be in StringUtils? It
>> feels reasonable to me. What are folks thoughts?
>>
>> Cheers,
>> -Rob
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [hidden email]
>> For additional commands, e-mail: [hidden email]
>>
>>


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: [lang] Appetite for new method StringUtils.toCamelCase(String str, char delimiter, boolean capitalizeFirstLetter)

garydgregory
IMO camel casing is all about words so [text] WordUtils. But why not have a
CamelCaseUtils instead?

Gary

On Jun 1, 2017 7:14 AM, "Rob Tompkins" <[hidden email]> wrote:

>
> > On Jun 1, 2017, at 10:11 AM, Gary Gregory <[hidden email]>
> wrote:
> >
> > Isn't this kind of stuff or anything camel case supposed to be in [text]
>
> I’m ok with that path as well. It feels like it’s on the line between the
> two components. Either way, it sounds like you’re not opposed to adding it
> to a component.
>
> Should it be TextUtils.toCamelCase(String str, char delimiter, boolean
> capitalizeFirstLetter), or WordUtils maybe, if we were to put it in [text]?
>
> -Rob
>
> > these days?
> >
> > Gary
> >
> > On Jun 1, 2017 7:03 AM, "Rob Tompkins" <[hidden email]> wrote:
> >
> >> Hello all,
> >>
> >> Folks at my day job have a method that takes in a space delimited String
> >> (or arbitrarily delimited string for that matter), and returns a camel
> >> cased string. Is there any reason that this shouldn’t be in
> StringUtils? It
> >> feels reasonable to me. What are folks thoughts?
> >>
> >> Cheers,
> >> -Rob
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: [hidden email]
> >> For additional commands, e-mail: [hidden email]
> >>
> >>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>
Reply | Threaded
Open this post in threaded view
|

Re: [lang] Appetite for new method StringUtils.toCamelCase(String str, char delimiter, boolean capitalizeFirstLetter)

Duncan Jones
On Thu, 1 Jun 2017 at 15:27, Gary Gregory <[hidden email]> wrote:

> IMO camel casing is all about words so [text] WordUtils. But why not have a
> CamelCaseUtils instead?
>
> Gary


+1. IMO it belongs in TEXT (if anywhere) and we should avoid classes with
static methods.

Per our other conservation about case conversions, we should carefully
specify whether this uses upper- or title-case and how it behaves in
different locales.

OOI, what is your real world use case for this?

Duncan


>
> On Jun 1, 2017 7:14 AM, "Rob Tompkins" <[hidden email]> wrote:
>
> >
> > > On Jun 1, 2017, at 10:11 AM, Gary Gregory <[hidden email]>
> > wrote:
> > >
> > > Isn't this kind of stuff or anything camel case supposed to be in
> [text]
> >
> > I’m ok with that path as well. It feels like it’s on the line between the
> > two components. Either way, it sounds like you’re not opposed to adding
> it
> > to a component.
> >
> > Should it be TextUtils.toCamelCase(String str, char delimiter, boolean
> > capitalizeFirstLetter), or WordUtils maybe, if we were to put it in
> [text]?
> >
> > -Rob
> >
> > > these days?
> > >
> > > Gary
> > >
> > > On Jun 1, 2017 7:03 AM, "Rob Tompkins" <[hidden email]> wrote:
> > >
> > >> Hello all,
> > >>
> > >> Folks at my day job have a method that takes in a space delimited
> String
> > >> (or arbitrarily delimited string for that matter), and returns a camel
> > >> cased string. Is there any reason that this shouldn’t be in
> > StringUtils? It
> > >> feels reasonable to me. What are folks thoughts?
> > >>
> > >> Cheers,
> > >> -Rob
> > >> ---------------------------------------------------------------------
> > >> To unsubscribe, e-mail: [hidden email]
> > >> For additional commands, e-mail: [hidden email]
> > >>
> > >>
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [hidden email]
> > For additional commands, e-mail: [hidden email]
> >
> >
>
Reply | Threaded
Open this post in threaded view
|

RE: [lang] Appetite for new method StringUtils.toCamelCase(String str, char delimiter, boolean capitalizeFirstLetter)

Roger Whitcomb
I have a similar method in our code -- the use case is to take user input (plain English field names, for instance) and turn it into variable names for DTOs (or similar).

Another use we have for it is taking Java format ENUM_NAMES and turning them into camelCaseVariableNames for things like dynamic property sheets.

~Roger Whitcomb

-----Original Message-----
From: Duncan Jones [mailto:[hidden email]]
Sent: Thursday, June 01, 2017 7:32 AM
To: Commons Developers List <[hidden email]>
Subject: Re: [lang] Appetite for new method StringUtils.toCamelCase(String str, char delimiter, boolean capitalizeFirstLetter)

On Thu, 1 Jun 2017 at 15:27, Gary Gregory <[hidden email]> wrote:

> IMO camel casing is all about words so [text] WordUtils. But why not
> have a CamelCaseUtils instead?
>
> Gary


+1. IMO it belongs in TEXT (if anywhere) and we should avoid classes
+with
static methods.

Per our other conservation about case conversions, we should carefully specify whether this uses upper- or title-case and how it behaves in different locales.

OOI, what is your real world use case for this?

Duncan


>
> On Jun 1, 2017 7:14 AM, "Rob Tompkins" <[hidden email]> wrote:
>
> >
> > > On Jun 1, 2017, at 10:11 AM, Gary Gregory <[hidden email]>
> > wrote:
> > >
> > > Isn't this kind of stuff or anything camel case supposed to be in
> [text]
> >
> > I’m ok with that path as well. It feels like it’s on the line
> > between the two components. Either way, it sounds like you’re not
> > opposed to adding
> it
> > to a component.
> >
> > Should it be TextUtils.toCamelCase(String str, char delimiter,
> > boolean capitalizeFirstLetter), or WordUtils maybe, if we were to
> > put it in
> [text]?
> >
> > -Rob
> >
> > > these days?
> > >
> > > Gary
> > >
> > > On Jun 1, 2017 7:03 AM, "Rob Tompkins" <[hidden email]> wrote:
> > >
> > >> Hello all,
> > >>
> > >> Folks at my day job have a method that takes in a space delimited
> String
> > >> (or arbitrarily delimited string for that matter), and returns a
> > >> camel cased string. Is there any reason that this shouldn’t be in
> > StringUtils? It
> > >> feels reasonable to me. What are folks thoughts?
> > >>
> > >> Cheers,
> > >> -Rob
> > >> -----------------------------------------------------------------
> > >> ---- To unsubscribe, e-mail: [hidden email]
> > >> For additional commands, e-mail: [hidden email]
> > >>
> > >>
> >
> >
> > --------------------------------------------------------------------
> > - To unsubscribe, e-mail: [hidden email]
> > For additional commands, e-mail: [hidden email]
> >
> >
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]
Reply | Threaded
Open this post in threaded view
|

Re: [lang] Appetite for new method StringUtils.toCamelCase(String str, char delimiter, boolean capitalizeFirstLetter)

Rob Tompkins

> On Jun 1, 2017, at 10:58 AM, Roger Whitcomb <[hidden email]> wrote:
>
> I have a similar method in our code -- the use case is to take user input (plain English field names, for instance) and turn it into variable names for DTOs (or similar).
>
> Another use we have for it is taking Java format ENUM_NAMES and turning them into camelCaseVariableNames for things like dynamic property sheets.

This is quite similar to what we are doing as well.

and @Gary - I like both ideas, WordUtils or CamelCaseUtils.

-Rob

>
> ~Roger Whitcomb
>
> -----Original Message-----
> From: Duncan Jones [mailto:[hidden email]]
> Sent: Thursday, June 01, 2017 7:32 AM
> To: Commons Developers List <[hidden email]>
> Subject: Re: [lang] Appetite for new method StringUtils.toCamelCase(String str, char delimiter, boolean capitalizeFirstLetter)
>
> On Thu, 1 Jun 2017 at 15:27, Gary Gregory <[hidden email]> wrote:
>
>> IMO camel casing is all about words so [text] WordUtils. But why not
>> have a CamelCaseUtils instead?
>>
>> Gary
>
>
> +1. IMO it belongs in TEXT (if anywhere) and we should avoid classes
> +with
> static methods.
>
> Per our other conservation about case conversions, we should carefully specify whether this uses upper- or title-case and how it behaves in different locales.
>
> OOI, what is your real world use case for this?
>
> Duncan
>
>
>>
>> On Jun 1, 2017 7:14 AM, "Rob Tompkins" <[hidden email]> wrote:
>>
>>>
>>>> On Jun 1, 2017, at 10:11 AM, Gary Gregory <[hidden email]>
>>> wrote:
>>>>
>>>> Isn't this kind of stuff or anything camel case supposed to be in
>> [text]
>>>
>>> I’m ok with that path as well. It feels like it’s on the line
>>> between the two components. Either way, it sounds like you’re not
>>> opposed to adding
>> it
>>> to a component.
>>>
>>> Should it be TextUtils.toCamelCase(String str, char delimiter,
>>> boolean capitalizeFirstLetter), or WordUtils maybe, if we were to
>>> put it in
>> [text]?
>>>
>>> -Rob
>>>
>>>> these days?
>>>>
>>>> Gary
>>>>
>>>> On Jun 1, 2017 7:03 AM, "Rob Tompkins" <[hidden email]> wrote:
>>>>
>>>>> Hello all,
>>>>>
>>>>> Folks at my day job have a method that takes in a space delimited
>> String
>>>>> (or arbitrarily delimited string for that matter), and returns a
>>>>> camel cased string. Is there any reason that this shouldn’t be in
>>> StringUtils? It
>>>>> feels reasonable to me. What are folks thoughts?
>>>>>
>>>>> Cheers,
>>>>> -Rob
>>>>> -----------------------------------------------------------------
>>>>> ---- To unsubscribe, e-mail: [hidden email]
>>>>> For additional commands, e-mail: [hidden email]
>>>>>
>>>>>
>>>
>>>
>>> --------------------------------------------------------------------
>>> - To unsubscribe, e-mail: [hidden email]
>>> For additional commands, e-mail: [hidden email]
>>>
>>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: [lang] Appetite for new method StringUtils.toCamelCase(String str, char delimiter, boolean capitalizeFirstLetter)

Amey Jadiye
In reply to this post by Rob Tompkins
+1 seems good to have in toolbox. pretty similar method I have seen in
Commons text WordUtils.capitalize() almost similar logic we will need here
,just not to capitalize first word and join them all, I'm in favour of
having this in WordUtils.

Regards,
Amey

On Thu, Jun 1, 2017, 7:33 PM Rob Tompkins <[hidden email]> wrote:

> Hello all,
>
> Folks at my day job have a method that takes in a space delimited String
> (or arbitrarily delimited string for that matter), and returns a camel
> cased string. Is there any reason that this shouldn’t be in StringUtils? It
> feels reasonable to me. What are folks thoughts?
>
> Cheers,
> -Rob
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>
Reply | Threaded
Open this post in threaded view
|

Re: [lang] Appetite for new method StringUtils.toCamelCase(String str, char delimiter, boolean capitalizeFirstLetter)

Matt Sicker
I like the idea. I've written similar code in a log4j2 branch for
normalizing configuration property names into camel case names.

On 1 June 2017 at 10:31, Amey Jadiye <[hidden email]> wrote:

> +1 seems good to have in toolbox. pretty similar method I have seen in
> Commons text WordUtils.capitalize() almost similar logic we will need here
> ,just not to capitalize first word and join them all, I'm in favour of
> having this in WordUtils.
>
> Regards,
> Amey
>
> On Thu, Jun 1, 2017, 7:33 PM Rob Tompkins <[hidden email]> wrote:
>
> > Hello all,
> >
> > Folks at my day job have a method that takes in a space delimited String
> > (or arbitrarily delimited string for that matter), and returns a camel
> > cased string. Is there any reason that this shouldn’t be in StringUtils?
> It
> > feels reasonable to me. What are folks thoughts?
> >
> > Cheers,
> > -Rob
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [hidden email]
> > For additional commands, e-mail: [hidden email]
> >
> >
>



--
Matt Sicker <[hidden email]>
Reply | Threaded
Open this post in threaded view
|

Re: [lang] Appetite for new method StringUtils.toCamelCase(String str, char delimiter, boolean capitalizeFirstLetter)

Duncan Jones
In reply to this post by Amey Jadiye
On Thu, 1 Jun 2017 at 16:31, Amey Jadiye <[hidden email]> wrote:

> +1 seems good to have in toolbox. pretty similar method I have seen in
> Commons text WordUtils.capitalize() almost similar logic we will need here
> ,just not to capitalize first word and join them all, I'm in favour of
> having this in WordUtils.


We've discussed deprecating WorldUtils once the wrapping methods are broken
out into separate classes. I'm in favour of an individual class to do this
work.


>
> Regards,
> Amey
>
> On Thu, Jun 1, 2017, 7:33 PM Rob Tompkins <[hidden email]> wrote:
>
> > Hello all,
> >
> > Folks at my day job have a method that takes in a space delimited String
> > (or arbitrarily delimited string for that matter), and returns a camel
> > cased string. Is there any reason that this shouldn’t be in StringUtils?
> It
> > feels reasonable to me. What are folks thoughts?
> >
> > Cheers,
> > -Rob
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [hidden email]
> > For additional commands, e-mail: [hidden email]
> >
> >
>
Reply | Threaded
Open this post in threaded view
|

Re: [lang] Appetite for new method StringUtils.toCamelCase(String str, char delimiter, boolean capitalizeFirstLetter)

Rob Tompkins


> On Jun 1, 2017, at 11:38 AM, Duncan Jones <[hidden email]> wrote:
>
>> On Thu, 1 Jun 2017 at 16:31, Amey Jadiye <[hidden email]> wrote:
>>
>> +1 seems good to have in toolbox. pretty similar method I have seen in
>> Commons text WordUtils.capitalize() almost similar logic we will need here
>> ,just not to capitalize first word and join them all, I'm in favour of
>> having this in WordUtils.
>
>
> We've discussed deprecating WorldUtils once the wrapping methods are broken
> out into separate classes. I'm in favour of an individual class to do this
> work.

Sure. Seems reasonable.

>
>
>>
>> Regards,
>> Amey
>>
>>> On Thu, Jun 1, 2017, 7:33 PM Rob Tompkins <[hidden email]> wrote:
>>>
>>> Hello all,
>>>
>>> Folks at my day job have a method that takes in a space delimited String
>>> (or arbitrarily delimited string for that matter), and returns a camel
>>> cased string. Is there any reason that this shouldn’t be in StringUtils?
>> It
>>> feels reasonable to me. What are folks thoughts?
>>>
>>> Cheers,
>>> -Rob
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: [hidden email]
>>> For additional commands, e-mail: [hidden email]
>>>
>>>
>>

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: [lang] Appetite for new method StringUtils.toCamelCase(String str, char delimiter, boolean capitalizeFirstLetter)

Benedikt Ritter-4
In reply to this post by Rob Tompkins
Hi,

> Am 01.06.2017 um 16:03 schrieb Rob Tompkins <[hidden email]>:
>
> Hello all,
>
> Folks at my day job have a method that takes in a space delimited String (or arbitrarily delimited string for that matter), and returns a camel cased string. Is there any reason that this shouldn’t be in StringUtils? It feels reasonable to me. What are folks thoughts?

Sorry to come late to this discussion. We should have a look at Guava’s CaseFormat class, which das camel case conversion and more. I think that design should lead yours.
I’ve come to the conclusion that anything that is more complex than StringUtils.isEmpty(String) (e.g. needs more than one parameter) should not be implemented as a static util method. Such a design always leads to procedural style coding which is an anti pattern IMHO.
CaseFormat is a nice example of how should an API can be build more OOP style.

Regards,
Benedikt

>
> Cheers,
> -Rob
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: [lang] Appetite for new method StringUtils.toCamelCase(String str, char delimiter, boolean capitalizeFirstLetter)

Amey Jadiye
+1

I like the way of implementation, I think we should have class in Commons
text CaseUtils.toCamelCase(String str, char delimiter, boolean
capitalizeFirstLetter)
Also this can have api for snake case (not sure if java need it)

@chtompki , If you wish I will submit code for review.

Regards,
Amey

On Jun 5, 2017 3:45 PM, "Benedikt Ritter" <[hidden email]> wrote:

> Hi,
>
> > Am 01.06.2017 um 16:03 schrieb Rob Tompkins <[hidden email]>:
> >
> > Hello all,
> >
> > Folks at my day job have a method that takes in a space delimited String
> (or arbitrarily delimited string for that matter), and returns a camel
> cased string. Is there any reason that this shouldn’t be in StringUtils? It
> feels reasonable to me. What are folks thoughts?
>
> Sorry to come late to this discussion. We should have a look at Guava’s
> CaseFormat class, which das camel case conversion and more. I think that
> design should lead yours.
> I’ve come to the conclusion that anything that is more complex than
> StringUtils.isEmpty(String) (e.g. needs more than one parameter) should not
> be implemented as a static util method. Such a design always leads to
> procedural style coding which is an anti pattern IMHO.
> CaseFormat is a nice example of how should an API can be build more OOP
> style.
>
> Regards,
> Benedikt
>
> >
> > Cheers,
> > -Rob
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [hidden email]
> > For additional commands, e-mail: [hidden email]
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>