Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Transformation file name to CamelCase in IntelliJ IDEA file templates
## file name transformation
## file-name => FileName
## Sources:
## http://stackoverflow.com/questions/6998412/velocity-string-function
## http://stackoverflow.com/questions/21288687/using-velocity-split-to-split-a-string-into-an-array-doesnt-seem-to-work
## http://velocity.apache.org/engine/releases/velocity-1.7/apidocs/org/apache/velocity/util/StringUtils.html#split(java.lang.String, java.lang.String)
#set( $CamelCaseName = "" )
#set( $part = "" )
#foreach($part in $NAME.split("-"))
#set( $CamelCaseName = "${CamelCaseName}$part.substring(0,1).toUpperCase()$part.substring(1).toLowerCase()" )
#end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.