Capitalizes the first character of a string using a regular expression.
The string to capitalize.
The input string with its first character capitalized, or the original string if empty or not a string.
capitalize("hello"); // "Hello"capitalize("world"); // "World"capitalize(""); // ""capitalize("a"); // "A" Copy
capitalize("hello"); // "Hello"capitalize("world"); // "World"capitalize(""); // ""capitalize("a"); // "A"
Capitalizes the first character of a string using a regular expression.