> ## Documentation Index
> Fetch the complete documentation index at: https://new.docs.falkordb.com/llms.txt
> Use this file to discover all available pages before exploring further.

# text.snakeCase

> Converts a string to snake_case format, separating words with underscores and lowercasing all characters.

## Description

Converts a string to snake\_case format by separating words with underscores and converting all characters to lowercase.

## Syntax

```cypher theme={null}
flex.text.snakeCase(string)
```

## Parameters

| Parameter | Type   | Required | Description                          |
| --------- | ------ | -------- | ------------------------------------ |
| `string`  | string | Yes      | The string to convert to snake\_case |

## Returns

**Type:** string

The input string converted to snake\_case format. Returns the original string if no matches are found. Returns `null` if input is `null`.

## Examples

### Example 1: Basic Usage

```cypher theme={null}
RETURN flex.text.snakeCase('HelloWorld') AS result
```

**Output:**

```text theme={null}
result
-----------
hello_world
```

### Example 2: Converting Multiple Formats

```cypher theme={null}
WITH ['camelCase', 'PascalCase', 'kebab-case', 'space separated'] AS inputs
UNWIND inputs AS input
RETURN input AS original, flex.text.snakeCase(input) AS snake
```

**Output:**

```text theme={null}
original        | snake
----------------|------------------
camelCase       | camel_case
PascalCase      | pascal_case
kebab-case      | kebab_case
space separated | space_separated
```

### Example 3: Database Column Naming

```cypher theme={null}
MATCH (u:User)
WITH u, keys(u) AS properties
UNWIND properties AS prop
RETURN prop AS camelCase, flex.text.snakeCase(prop) AS dbColumn
```

## Notes

* Returns `null` for `null` input
* Handles multiple word boundary detection patterns
* All characters are converted to lowercase
* Words are separated by underscores
* Common for database column names and Python conventions
* Returns the original string if no word boundaries are detected

## See Also

* [text.camelCase](/udfs/flex/text/camelCase) - Convert to camelCase format
* [text.upperCamelCase](/udfs/flex/text/upperCamelCase) - Convert to UpperCamelCase format

## Frequently Asked Questions

<AccordionGroup>
  <Accordion title="What separators does flex.text.snakeCase recognize?">
    It recognizes spaces, hyphens, and camelCase/PascalCase word boundaries (transitions between lowercase and uppercase letters).
  </Accordion>

  <Accordion title="Are all characters lowercased?">
    Yes. All characters in the output are converted to lowercase, with words separated by underscores.
  </Accordion>
</AccordionGroup>
