# Split

This is a pre-built Action located under the **@Generic Element**. The functionality of this Action in Avo Assure is to split a given string into smaller parts using a specified separator or character. The resulting parts are stored in a dynamic variable.

## **Syntax**

**Input Value**: `<string>;<split character>`&#x20;

| Argument                                | Description                                                                                                                      |
| --------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------- |
| <p>\<string></p><p>(Required)</p>       | Provide the string that needs to be split.                                                                                       |
| <p>\<split character><br>(Required)</p> | Provide the character or symbol that determines where the string should be divided (for example, a comma (,), space, or number). |

**Output Value**: `<Dynamic Variable>;<Dynamic Variable>(Optional)`

| Argument                                  | Description                                                      |
| ----------------------------------------- | ---------------------------------------------------------------- |
| <p>\<Dynamic Variable><br> (Required)</p> | This dynamic variable stores the separated string.               |
| <p>\<Dynamic Variable><br>(Optional)</p>  | This dynamic variable Stroe the status as **True** or **False**. |

### **Example:** Splitting a String

In this example, we explain how to divide a string into separate parts.

* **Action**: Split
* **Input Value**: John\&Smith;&
  * The first argument (**John\&Smith**) specifies the string to be split.
  * The second argument (**&**) specifies the delimiter or split character.
* **Output Value**: {Split Values}
  * The resulting list of split strings (\['John', 'Smith']) is stored in this **{Split Values}** dynamic variable.
  * If the second output variable is defined, it stores the action status with the following possible values:
    * **True**: If the string is successfully split using the specified delimiter.
    * **False**: If the split operation fails due to an invalid or missing delimiter.
* **Logical Explanation**: The **Split** action fetches the value from the **Input Value** column **(John\&Smith;&)** and splits it into parts using the specified split character (&). The resulting list of split values (\['John', 'Smith']) is stored in the **{Split Values}** variable.

<figure><img src="/files/QKI3pdZwZPm7YiFZFcil" alt=""><figcaption></figcaption></figure>

#### **Example 2: Accessing and Displaying a Specific Word from a Split String**

In this example, we explain how to split a string, retrieve a specific word using its array index, and display it.

* **Action**: Split
* **Input Value**: John\&Smith\&David;&
  * The first argument (**John\&Smith\&David**) specifies the string to be split.
  * The second argument (**&**) specifies the delimiter or split character.
* **Output Value**: {Split Values}
  * The resulting list of split string (\['John', 'Smith', 'David']) is stored in this **{Split Values}** dynamic variable.
  * If the second output variable is defined, it stores the operation status with the following possible values:
    * **True**: If the string is successfully split.
    * **False**: If the split operation fails due to an invalid delimiter or empty string.
* **Using Array Index**:
  * **{Split Values\[0]}** → stores **John**
  * **{Split Values\[1]}** → stores **Smith**
  * **{Split Values\[2]}** → stores **David**
* **Logical Explanation**: The **Split** action takes the value from the **Input Value** column (**John\&Smith\&David;&**) and splits it into parts using the specified split character (&). It stores the list of split values in the **{Split Values}** dynamic variable as \['John', 'Smith', 'David']. Using array indexing, the user can retrieve a specific word from the split array. In this scenario, the **Display Variable Value** action displays the 0th index value of the split strings by using the **{Split Values\[0]}** variable as input and shows the value (John).

<figure><img src="/files/TBMxvpaoG0s1ubEkgF4E" alt=""><figcaption></figcaption></figure>

#### **Knowledge Bites:**&#x20;

Here are some examples of different string scenarios:

| String               | Input Value          | Result                |
| -------------------- | -------------------- | --------------------- |
| Text Strings         | List & Task;&        | "List", "Task"        |
| Numeric Strings      | 1223524214;5         | "1223", "24214"       |
| Special Character    | abc\@do & main.com;& | "abc\@do", "main.com" |
| Alphanumeric strings | ID87&6;&             | "ID87", "6"           |


---

# Agent Instructions: Querying This Documentation

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

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.avoautomation.com/avo-assure/actions/generic/string-operations/split.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
