Skip to content

Instantly share code, notes, and snippets.

@kingqi
Forked from Pencroff/CamelCaseMacro.velocity
Created December 22, 2021 07:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kingqi/0261cf47c9014f1bc68c2699c3b820e4 to your computer and use it in GitHub Desktop.
Save kingqi/0261cf47c9014f1bc68c2699c3b820e4 to your computer and use it in GitHub Desktop.
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