Description
Capitalizes the first character of a string, converting it to uppercase while leaving the rest of the string unchanged.Syntax
Parameters
Returns
Type: string The input string with its first character converted to uppercase. Returnsnull if the input is null, and empty string if input is empty.
Examples
Example 1: Basic Usage
Example 2: Capitalizing Node Properties
Notes
- Returns
nullfornullinput - Returns empty string for empty string input
- Only affects the first character
- Does not change the case of subsequent characters
See Also
- text.decapitalize - Lowercase the first character
- text.camelCase - Convert to camelCase format
- text.upperCamelCase - Convert to UpperCamelCase format
Frequently Asked Questions
Does flex.text.capitalize change the rest of the string?
Does flex.text.capitalize change the rest of the string?
No. It only converts the first character to uppercase — all other characters remain exactly as they are.
What happens with an empty string input?
What happens with an empty string input?
It returns an empty string. For
null input, it returns null.