capitalize()
ts
function capitalize(this): string;Defined in: string/capitalize.ts:17
Converts the first character of a string to uppercase and returns the resulting string. All remaining characters are left unchanged.
Parameters
| Parameter | Type | Description |
|---|---|---|
this | string | string instance |
Returns
string
A new string with the first character converted to uppercase. If the string is empty, an empty string is returned.
Example
ts
console.assert("hello".capitalize() === "Hello");Since
1.0.0
Author
Ian Wenneckers