Human readable to camel case in Scala

August 13, 2020 at 08:18

After searching for a simple way to convert a string like I am a nice string (human friendly) into something like IAmANiceString (camel-case) and finding formulas only for the opposite, I decided to write the solution myself.

I’m sure it’s not the fastest and it doesn’t use regular expressions, but it’s simple to read (for me at least) and should allow me to build such string transformations myself in the future.

Anyways, here the function:

Hope it’s useful for you, and if you have any feedback, feel free to leave it on the comments.