-
Couldn't load subscription status.
- Fork 0
ProtoString toSnakeCase() Method
Seth Clydesdale edited this page May 30, 2015
·
1 revision
<< Back to Case Manipulation Methods
Changing a string to Lower Snake Case.
'Lower Snake Case'.toSnakeCase(); // returns 'lower_snake_case'Passing true as the parameter changes the casing method to Upper Snake Case.
'Upper Snake Case'.toSnakeCase(true); // returns 'UPPER_SNAKE_CASE'The toSnakeCase method is used to change a string to snake case by replacing spaces, newlines, and dashes with an underscore. The string is then returned either in all lowercase or uppercase characters, depending on your input. Snake Case is commonly used in programming languages, such as for variable names, as it is believed to be easier to read than Camel Case.
String.toSnakeCase(upper);| Parameter | Description |
|---|---|
| upper | A boolean value which determines the entire casing of the string. If set to true the string will be returned in uppercase. Defaults to lowercase if left undefined. |
Home • History • ProtoString • Created by Seth Clydesdale