Skip to content

ProtoString toCamelCase() Method

Seth Clydesdale edited this page May 28, 2015 · 5 revisions

<< Back to Case Manipulation Methods

Examples

Changing a string to Lower Camel Case.

'Lower camel case'.toCamelCase(); // returns 'lowerCamelCase'

Passing true as the parameter changes the casing method to Upper Camel Case.

'upper camel case'.toCamelCase(true); // returns 'UpperCamelCase'

Description

Using this method on a string will change the casing to Camel Case, by capitalizing all words, except the first, and removing whitespace. However, if true is passed as the parameter, the first letter will be capitalized. Camel Case is commonly used in programming languages, such as JavaScript.

Syntax

String.toCamelCase(upper);

Parameters

Parameter Description
upper A boolean value which determines the casing of the first character. If set to true the first character will be capitalized, thus changing the casing method to Upper Camel Case. Defaults to lowercasing the first character if left undefined.
Clone this wiki locally