Apache lowercase first letter

I have this code that converts the string "dotted" in camelCase to a WebStorm file template:

#set($Controller_name = ${StringUtils.removeAndHump(${NAME}, ".")}) 

For example, it converts foo.bar.test to FooBarTest .

But I need to convert it from foo.bar.test to FooBarTest .

How can i do this?

+5
source share
1 answer

Here is what finally helped me:

 #set($Controller_name = ${StringUtils.removeAndHump(${NAME}, ".")}) #set($first_letter = $Controller_name.substring(0,1).toLowerCase()) #set($the_rest = $Factory_name.substring(1)) #set($Controller_name = ${first_letter} + ${the_rest}) 

It can be reduced 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.

+8
source

Source: https://habr.com/ru/post/1235552/


All Articles