Reference · Parsing, formatting and shared types
capitalizeWordsfunction
Capitalizes the first letter of each word.
Import it
import { capitalizeWords } from "@johnmorrisdotca/address-plus";
Definition
function capitalizeWords(text: string): string
Parameters
| Name | Type | Description |
|---|---|---|
text | string | The text. |
Returns
string
The text with each word's first letter in capitals and the rest as written.
Examples
import { capitalizeWords } from "@johnmorrisdotca/address-plus";
console.log(capitalizeWords("new york city"));
// → "New York City"New York CityWhat it prints (run when this page was built)