I've got this code, which converts "dotted" string to camelCase in WebStorm File Template:
#set($Controller_name = ${StringUtils.removeAndHump(${NAME}, ".")})
For example it converts foo.bar.test
to FooBarTest
.
But what I need is to convert it from foo.bar.test
to fooBarTest
.
How can I do that?
This is what finally worked for me:
#set($Controller_name = ${StringUtils.removeAndHump(${NAME}, ".")})
#set($first_letter = $Controller_name.substring(0,1).toLowerCase())
#set($the_rest = $Controller_name.substring(1))
#set($Controller_name = ${first_letter} + ${the_rest})
It could be shortened to:
#set($Controller_name = ${StringUtils.removeAndHump(${NAME}, ".")})
#set($Controller_name = $Controller_name.substring(0,1).toLowerCase() + $Controller_name.substring(1))
Thanks @LazyOne for pointing me in the right direction.