Turn a string of format "foo_bar" into camelCase with the first letter in lower case: "fooBar"
Turn a string of format "foo_bar" into camelCase with the first letter in lower case: "fooBar"
This function is especially used to camelCase method names.
the String to camelCase
the camelCased string
Camel case may start with a capital letter (called "Pascal Case" or "Upper Camel Case") or, especially often in programming languages, with a lowercase letter. In this code's perspective, PascalCase means the first char is capitalized while camelCase means the first char is lowercased. In general both can be considered equivalent although by definition "CamelCase" is a valid camel-cased word. Hence, PascalCase can be considered to be a subset of camelCase. Copied from the Lift Framework and RENAMED: https://github.com/lift/framework/blob/master/core/util/src/main/scala/net/liftweb/util/StringHelpers.scala Apache 2.0 License: https://github.com/lift/framework/blob/master/LICENSE.txt
Turns a string of format "foo_bar" into PascalCase "FooBar"
Turns a string of format "foo_bar" into PascalCase "FooBar"
the String to PascalCase
the PascalCased string
Camel case may start with a capital letter (called "Pascal Case" or "Upper Camel Case") or, especially often in programming languages, with a lowercase letter. In this code's perspective, PascalCase means the first char is capitalized while camelCase means the first char is lowercased. In general both can be considered equivalent although by definition "CamelCase" is a valid camel-cased word. Hence, PascalCase can be considered to be a subset of camelCase. Copied from the "lift" framework and RENAMED: https://github.com/lift/framework/blob/master/core/util/src/main/scala/net/liftweb/util/StringHelpers.scala Apache 2.0 License: https://github.com/lift/framework/blob/master/LICENSE.txt Functional code courtesy of Jamie Webb ([email protected]) 2006/11/28
Turn a string of format "FooBar" into snake case "foo_bar"
Turn a string of format "FooBar" into snake case "foo_bar"
the underscored string
toSnakeCase is not reversible, ie. in general the following will _not_ be true:
s == toCamelCase(toSnakeCase(s))
Copied from the Lift Framework and RENAMED: https://github.com/lift/framework/blob/master/core/util/src/main/scala/net/liftweb/util/StringHelpers.scala Apache 2.0 License: https://github.com/lift/framework/blob/master/LICENSE.txt