Skip to content

Instantly share code, notes, and snippets.

@phcorp
Last active November 9, 2016 13:12
Show Gist options
  • Save phcorp/2e3fa27e011fe597b70f5ff52b7391e6 to your computer and use it in GitHub Desktop.
Save phcorp/2e3fa27e011fe597b70f5ff52b7391e6 to your computer and use it in GitHub Desktop.
Translating CamelCase into human readable string in PHPStorm
## Format CamelCase to text
## fooBar => Foo bar
## fooBAR => Foo bar
## References:
## https://velocity.apache.org/engine/devel/user-guide.html
## https://www.jetbrains.com/help/phpstorm/2016.1/template-languages-velocity-and-freemarker.html
#set ($formattedName = $NAME)
#set ($formattedName = $formattedName.replaceAll('([A-Z]+)', ' $1'))
#set ($formattedName = $formattedName.toLowerCase())
#set ($firstLetter = $formattedName.substring(0,1).toUpperCase())
#set ($otherLetters = $formattedName.substring(1))
#set ($formattedName = "${firstLetter}${otherLetters}")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment