text.camelCase
Description
Converts a string to camelCase format by removing non-alphanumeric characters and capitalizing the first letter of each word except the first.
Syntax
flex.text.camelCase(string)
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
string |
string | Yes | The string to convert to camelCase |
Returns
Type: string
The input string converted to camelCase format. Returns null if input is null.
Examples
Example 1: Basic Usage
RETURN flex.text.camelCase('hello world') AS result
Output:
result
----------
helloWorld
Example 2: Converting Field Names
RETURN flex.text.camelCase('user_first_name') AS result
Output:
result
-------------
userFirstName
Example 3: Normalizing Property Names
WITH ['first-name', 'last_name', 'Email Address'] AS fields
UNWIND fields AS field
RETURN field AS original, flex.text.camelCase(field) AS camelCase
Notes
- Returns
nullfornullinput - Removes all non-alphanumeric characters
- First character is always lowercase
- Subsequent words start with uppercase
- Useful for normalizing field names to JavaScript/JSON conventions
See Also
- text.upperCamelCase - Convert to UpperCamelCase (PascalCase)
- text.snakeCase - Convert to snake_case format
- text.capitalize - Capitalize first character only
Frequently Asked Questions 2
What separators does flex.text.camelCase recognize?
It recognizes spaces, hyphens, underscores, and transitions between lowercase and uppercase characters as word boundaries.
How is camelCase different from upperCamelCase?
In camelCase the first letter is lowercase (e.g., helloWorld), while upperCamelCase (PascalCase) capitalizes the first letter too (e.g., HelloWorld).