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

> ## Agent Instructions
> FalkorDB is a graph database that speaks the Redis protocol. Queries are issued as OpenCypher through the GRAPH.QUERY and GRAPH.RO_QUERY commands, not over Bolt or a SQL connection.
> FalkorDB implements a subset of OpenCypher with proprietary extensions. Do not assume Neo4j-only syntax or procedures are available — check /cypher/cypher-support and /cypher/known-limitations before using a clause.
> FalkorDB is the successor to RedisGraph, but they are separate products. Do not present RedisGraph commands, versions, or limitations as current FalkorDB behavior.
> Use the official clients listed in /getting-started/clients rather than generic Redis or Neo4j drivers, and prefer the language the user is already working in.
> Configuration parameters are set with GRAPH.CONFIG SET or at startup; cite the exact parameter name from /getting-started/configuration rather than inventing one.
> This site covers four products: FalkorDB (core), FalkorDB Cloud, FalkorDB Enterprise, and the GraphRAG SDK. Name which one an answer applies to, since setup and operations differ.

# text.swapCase

> Swaps the case of every character in a string — uppercase becomes lowercase and vice versa.

## Description

Swaps the case of each character in a string - uppercase characters become lowercase and vice versa.

## Syntax

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

## Parameters

| Parameter | Type   | Required | Description             |
| --------- | ------ | -------- | ----------------------- |
| `string`  | string | Yes      | The string to swap case |

## Returns

**Type:** string

A new string with all uppercase characters converted to lowercase and all lowercase characters converted to uppercase. Returns `null` if input is `null`.

## Examples

### Example 1: Basic Usage

```cypher theme={null}
RETURN flex.text.swapCase('Hello World') AS result
```

**Output:**

```text theme={null}
result
-------------
hELLO wORLD
```

### Example 2: Swapping Mixed Case

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

**Output:**

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

## Notes

* Returns `null` for `null` input
* Non-alphabetic characters remain unchanged
* Applies to all characters in the string, not just the first

## See Also

* [text.capitalize](/udfs/flex/text/capitalize) - Uppercase the first character
* [text.camelCase](/udfs/flex/text/camelCase) - Convert to camelCase format
* [text.snakeCase](/udfs/flex/text/snakeCase) - Convert to snake\_case format

## Frequently Asked Questions

<AccordionGroup>
  <Accordion title="Does flex.text.swapCase affect non-alphabetic characters?">
    No. Numbers, punctuation, and other non-alphabetic characters remain unchanged.
  </Accordion>

  <Accordion title="Is swapCase applied to all characters or just the first?">
    It is applied to **every** character in the string — each uppercase letter becomes lowercase and vice versa.
  </Accordion>
</AccordionGroup>
