Hi Richard,

On Wed, Oct 26, 2022 at 11:42 AM Richard O'Keefe <rao...@gmail.com> wrote:

> What's wrong with
>
> $- join: (s cutCamelCase collect: [ :each | each asLowercase])
>
> where s is the string you want to transform?
> I'm sure you're aware of the proverb:
>   You have a problem and you decide to solve it with
>   a regular expression.  Now you have TWO problems.
>

I was not, but I like it :)


>
> MYWeirdName and MyWeirdName both map to my-weird-name,
> but perhaps you are happy with that.
>

Indeed - that is not a problem in my situation.

cheers
Siemen



>
> On Sat, 22 Oct 2022 at 21:57, Siemen Baader <siemenbaa...@gmail.com>
> wrote:
>
>> Hi,
>>
>> I'm looking for an elegant way to convert class names with optional
>> namespace prefixes to names for custom html elements.
>>
>> MYCustomElement and CustomElement
>>
>> to
>> <my-custom-element> and <custom-element>
>>
>> There must be an elegant way to do it with regex or inject, but I'm
>> embarrassed to say I can't get my head around it. I can get it to match the
>> regex '((:isUppercase:+)*)((:isUppercase::isLowercase:+)*)', (if I recall
>> correctly) but can't get a collection of the individual elements 'MY'
>> 'Custom" 'Element' to lowercase and join.
>>
>> Thanks for any hints!
>>
>> cheers
>> Siemen
>>
>

Reply via email to