-
Couldn't load subscription status.
- Fork 0
ProtoString capitalize() Method
Seth Clydesdale edited this page May 24, 2015
·
1 revision
<< Back to Case Manipulation Methods
The letter "C" is converted to uppercase, because it's the first character in the string. The rest of the string is converted to lowercase.
'coffee TIME!'.capitalize(); // returns 'Coffee time!'Passing true as the parameter, will keep the default casing for the rest of the string.
'coffee TIME!'.capitalize(true); // returns 'Coffee TIME!'The capitalize method is used to capitalize the first character in a string. The rest of the characters in the string are changed to lowercase. This method is intended to be similar to the one in Python.
String.capitalize(keepCase);| Parameter | Description |
|---|---|
| keepCase | A boolean value that specifies whether or not you want to keep the default casing for the rest of the string. Passing true will return "cOFFEE" as "COFFEE", instead of "Coffee." Defaults to lowercasing the rest of the string if left undefined. |
Home • History • ProtoString • Created by Seth Clydesdale