Hi,

I'm using inflex for this. You can take a look at the package.

On Monday, April 11, 2022 at 11:28:14 PM UTC+8 Andrey Yugai wrote:

> Hey there, I think that would be a nice addition in general, but 
> Macro.camelize/1 <https://hexdocs.pm/elixir/Macro.html#camelize/1> has a 
> very specific purpose:
>
> This function was designed to camelize language identifiers/tokens, that's 
> why it belongs to the Macro <https://hexdocs.pm/elixir/Macro.html#content> 
> module. Do not use it as a general mechanism for camelizing strings as it 
> does not support Unicode or characters that are not valid in Elixir 
> identifiers.
>
> ​
> If you take look at the source code, you will see that camelization will 
> work only on ASCII strings, and with "_" as delimiters, but it shouldn't 
> too hard to write camelize/2 that suits your needs.
>
>
>
> ------- Original Message -------
>
> On Monday, April 11th, 2022 at 21:05, 최병욱 <[email protected]> wrote:
>
> Hi everyone,
>
> *Background*
> Macro.camelize/1 is convert string to upper camel case (pascal case).
> How do I convert lower camel case (camel case with the first letter 
> lowercase) 
>
> *Proposal*
> @spec camelize(String.t(), boolean()) :: String.t()
>   def camelize(string, upper? \\ true)
>
> *Example*
> Macro.camelize("foo_bar")
> > "FooBar"
> Macro.camelize("foo_bar", false)
> > "fooBar"
> Macro.camelize("d_day", false)
> > "dDay"
>
> What is your opinion :)
>
> -- 
> You received this message because you are subscribed to the Google Groups 
> "elixir-lang-core" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to [email protected].
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/elixir-lang-core/d476c06c-3c91-44ce-8c73-15f26e97eb07n%40googlegroups.com
>  
> <https://groups.google.com/d/msgid/elixir-lang-core/d476c06c-3c91-44ce-8c73-15f26e97eb07n%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"elixir-lang-core" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elixir-lang-core/639c44fa-9a16-4288-997e-60f37e19507bn%40googlegroups.com.

Reply via email to