> For the complete documentation index, see [llms.txt](https://docs.middle.app/middle-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.middle.app/middle-docs/product/accounts/workflow-parameters/text-manipulation.md).

# Text Manipulation

Text manipulation parameters can be added before a text variable or text constant. Each one takes child parameters in `params`; the parent does not use `expression`. The examples below are complete parameter objects from the [workflow JSON format](https://docs.middle.app/middle-docs/product/accounts/workflow-parameters.md).

All of these parameters require a string as their first child. A null value or a number causes an error; it is not automatically converted to text. Use a [Text](https://docs.middle.app/middle-docs/product/accounts/workflow-parameters/constants-and-calculated-values.md#text) parameter when you need to combine or format values first.

## Left Strip

JSON type: `lstrip`.

Remove characters from the left side of a string. The first child is the text. An optional second child gives the set of characters to remove; leave it out to remove whitespace, including spaces, tabs, and newlines.

```json
{
  "type": "lstrip",
  "params": [
    {
      "type": "template",
      "expression": "00123"
    },
    {
      "type": "template",
      "expression": "0"
    }
  ]
}
```

This returns `"123"`. The second child is a set of individual characters, not a prefix to remove once. For example, `"0 "` removes any sequence of zeros and spaces at the beginning. Stripping stops at the first character outside that set. Characters elsewhere in the string stay unchanged.

## Right Strip

JSON type: `rstrip`.

Remove characters from the right side of a string. The first child is the text. An optional second child gives the character set; leave it out to remove whitespace.

```json
{
  "type": "rstrip",
  "params": [
    {
      "type": "template",
      "expression": "Sally..."
    },
    {
      "type": "template",
      "expression": "."
    }
  ]
}
```

This returns `"Sally"`. As with Left Strip, the second child is a set of characters, not a suffix. It removes matching characters from the end until it reaches a character outside that set.

## Strip

JSON type: `strip`.

Remove characters from both ends of a string. The first child is the text. An optional second child gives the character set; leave it out to remove whitespace. It does not remove spaces or other characters from the middle.

```json
{
  "type": "strip",
  "params": [
    {
      "type": "template",
      "expression": "  Sally Smith \t"
    }
  ]
}
```

This returns `"Sally Smith"`. For all three Strip options, an empty character-set string removes nothing. At runtime, a null second child uses the whitespace default, though the editor expects text. The first child still needs to be a string.

## Splitlines

JSON type: `splitlines`.

Split a string into an array of strings at line breaks. The first and only child is the text. Middle also strips whitespace from both ends of each line.

```json
{
  "type": "splitlines",
  "params": [
    {
      "type": "template",
      "expression": " Sally \n\nMarco\r\nPat \n"
    }
  ]
}
```

This returns `["Sally", "", "Marco", "Pat"]`. Both Unix (`\n`) and Windows (`\r\n`) line breaks work. Blank lines within the text become empty strings; a final line break does not add another item. An empty input string returns an empty array.

This enables text lists to be used with array parameters or comparisons. For example, a list of email addresses can be compared with one email address. If the array is on the left, use **(Array of Strings) includes** (`ARRAY_STRING_INCLUDES`); if the array is on the right, use **(String) is contained within** (`STRING_IS_IN`). Array membership checks compare whole values, not parts of a line. See [Flow Control](https://docs.middle.app/middle-docs/product/accounts/workflow-parameters/flow-control.md) for all comparison options.

## Uppercase

JSON type: `upper`.

Convert a string to all uppercase. The first and only child supplies the text.

```json
{
  "type": "upper",
  "params": [
    {
      "type": "template",
      "expression": "Sally Smith"
    }
  ]
}
```

This returns `"SALLY SMITH"`. Digits, spaces, and punctuation stay unchanged. An empty string stays empty.

## Lowercase

JSON type: `lower`.

Convert a string to all lowercase. The first and only child supplies the text.

```json
{
  "type": "lower",
  "params": [
    {
      "type": "template",
      "expression": "Sally@Example.com"
    }
  ]
}
```

This returns `"sally@example.com"`. It changes letter case only; it does not remove whitespace. Use Strip as well if you need to remove whitespace around an email address.

## Capitalize

JSON type: `capitalize`.

Convert the first character to uppercase and the rest of the string to lowercase. The first and only child supplies the text. This capitalizes the whole string, not each word.

```json
{
  "type": "capitalize",
  "params": [
    {
      "type": "template",
      "expression": "sALLY SMITH"
    }
  ]
}
```

This returns `"Sally smith"`. Leading whitespace remains in place, so `" sALLY"` becomes `" sally"`. Use Strip first if the first letter should be the first character. An empty string stays empty.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.middle.app/middle-docs/product/accounts/workflow-parameters/text-manipulation.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
