-
-
Save kingqi/0261cf47c9014f1bc68c2699c3b820e4 to your computer and use it in GitHub Desktop.
Transformation file name to CamelCase in IntelliJ IDEA file templates
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## 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