# String

## Introduction

The String library in Autom Mate provides a set of actions for performing operations on textual data. These actions enable users to manipulate, format, and extract information from text strings efficiently.

The purpose of the String component is to offer a range of functionalities for handling and processing textual data within automated workflows. It allows users to modify, transform, and analyze text strings as needed.

## What is String?

The String component encompasses various actions designed to work with text data. These actions facilitate tasks such as appending, assigning values, capitalizing, converting to date or number formats, finding and replacing text, and more.

#### Key Features

* <mark style="color:orange;">**Text Manipulation**</mark><mark style="color:orange;">:</mark>
  * <mark style="color:orange;">Perform operations to modify and manipulate text strings.</mark>
* <mark style="color:orange;">**Conversion**</mark><mark style="color:orange;">:</mark>
  * <mark style="color:orange;">Convert text values to different formats such as dates or numbers.</mark>
* <mark style="color:orange;">**Search and Replace**</mark><mark style="color:orange;">:</mark>
  * <mark style="color:orange;">Find specific text patterns and replace them with new values.</mark>
* <mark style="color:orange;">**Text Length**</mark><mark style="color:orange;">:</mark>
  * <mark style="color:orange;">Retrieve the length of text strings for analysis.</mark>

## How To Use Action

### Append

<figure><img src="/files/6aIBADl0J5qSeTwn2lNB" alt=""><figcaption></figcaption></figure>

**Description:** The **Append** action is used to add new data to an existing text or data structure.

**Usage:**

* **Value to Assign**:
  * <mark style="color:green;">Enter the textual data value to be added.</mark>
* **Source to be Appended**:
  * <mark style="color:green;">Add the data at the end of the existing content.</mark>

### Assign

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

**Description:** The **Assign** action defines a textual value to be assigned to a variable.

**Usage:**

* **Value to Assign**:
  * <mark style="color:green;">Enter the textual data value to be assigned.</mark>
* **Source to be Assigned**:
  * <mark style="color:green;">Specify the variable to which the data will be assigned.</mark>

### Capitalize

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

**Description:** The **Capitalize** action converts the first letter of a text string to uppercase.

**Usage:**

* **Source String**:
  * <mark style="color:green;">Enter the text value to be capitalized.</mark>
* **Capitalize**:
  * <mark style="color:green;">Choose to capitalize only the first letter or multiple letters.</mark>
* **Assign the output to variable**:
  * <mark style="color:green;">Determine the variable for the capitalized data.</mark>

### Convert String to Date

<figure><img src="/files/5sMIHAh1CPPlMu54yIUH" alt=""><figcaption></figcaption></figure>

**Description:** The **Convert (Date)** action transforms a text value into a date type.

**Usage:**

* **Source String**:
  * <mark style="color:green;">Enter the text value to be converted.</mark>
* **Source Date Format**:
  * <mark style="color:green;">Specify the format of the source text.</mark>
* **New Date Format**:
  * <mark style="color:green;">Select the desired date format after conversion.</mark>
* **Assign the output to the variable**:
  * <mark style="color:green;">Determine the variable for the converted date.</mark>

### Convert to Number

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

**Description:** The **Convert (Number)** action changes a text value to a number type.

**Usage:**

* **Source String**:
  * <mark style="color:green;">Enter the text value to be converted.</mark>
* **Assign the output to variable**:
  * <mark style="color:green;">Determine the variable for the converted number.</mark>
* **Round Number**:
  * <mark style="color:green;">Specify the number of digits after the decimal point.</mark>

### Length

<figure><img src="/files/5bWLWQkDQmucysWwzhmG" alt=""><figcaption></figcaption></figure>

**Description:** The **Length** action retrieves the length of a text value.

**Usage:**

* **Source String**:
  * <mark style="color:green;">Enter the text value to calculate its length.</mark>
* **Assign the output to variable**:
  * <mark style="color:green;">Determine the variable for the length information.</mark>

### Lowercase

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

**Description:** The **Lowercase** action converts text data from uppercase to lowercase.

**Usage:**

* **Source String**:
  * <mark style="color:green;">Enter the text value to be converted.</mark>
* **Assign the output to variable**:
  * <mark style="color:green;">Determine the variable for the converted lowercase data.</mark>

### Prepend

<figure><img src="/files/1RPXCdNBP2B4y4WXn9PF" alt=""><figcaption></figcaption></figure>

**Description:** The **Prepend** action adds data to the beginning of an existing text.

**Usage:**

* **Value to Assign**:
  * <mark style="color:green;">Enter the textual data value to be added.</mark>
* **Source to be Prepended**:
  * <mark style="color:green;">Add the data at the beginning of the existing content.</mark>

### Replace

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

**Description:** The **Replace** action substitutes new textual data for specified text in a string.

**Usage:**

* **Source String**:
  * <mark style="color:green;">Enter the text value to search for replacements.</mark>
* **Find String**:
  * <mark style="color:green;">Specify the text to be replaced.</mark>
* **When Finding**:
  * <mark style="color:green;">Choose options for matching case sensitivity.</mark>
* **Replace With**:
  * <mark style="color:green;">Enter the new text to replace the found string.</mark>
* **Assign the output to the variable**:
  * <mark style="color:green;">Determine the variable for the replaced data.</mark>

### **Regex**

#### **Description and Purpose**

The **String - Regex** action allows Autom Mate users to extract all matching substrings from a given source string based on a user-defined regular expression pattern. This is useful for dynamic text parsing, validation, and data extraction within workflows.

By defining the regex pattern and source text, users can obtain an array of matches to guide downstream logic and processing.

***

#### **Usage Instructions**

{% stepper %}
{% step %}
**Provide Source String**

**Source String (Required):**\
Enter or map the full text where you want to search using the regex.
{% endstep %}

{% step %}
**Define Regex Pattern**

**Regex (Required):**\
Enter the regular expression pattern to be applied on the source string.

Example:

```
\bentity\b
```

This pattern searches for exact occurrences of the word "entity".
{% endstep %}

{% step %}
**Assign Output Variable**

**Assign the output to variable (Required):**\
Select an array-type variable (e.g., `arr`) to store all matched results.
{% endstep %}

{% step %}
**Execute and Review**

Run the action and verify the output variable to confirm extracted substrings.
{% endstep %}
{% endstepper %}

***

#### **Inputs**

| Field               | Description                                    |
| ------------------- | ---------------------------------------------- |
| **Source String**   | Text to apply the regex search on.             |
| **Regex**           | The regex pattern for matching substrings.     |
| **Output Variable** | Array variable to hold all matched substrings. |

***

#### **Outputs**

| Field               | Description                                  |
| ------------------- | -------------------------------------------- |
| **Output Variable** | Array of strings matching the regex pattern. |

***

### **Example Output**

```json
["entity", "entity", "entity", "entity"]
```

***

### Search

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

**Description:** The **Search** action finds specific text patterns within a string.

**Usage:**

* **Source String**:
  * <mark style="color:green;">Enter the text value to search within.</mark>
* **Find String**:
  * <mark style="color:green;">Specify the text pattern to search for.</mark>
* **When Finding**:
  * <mark style="color:green;">Choose options for matching case sensitivity.</mark>
* **Assign the output to the variable**:
  * <mark style="color:green;">Determine the variable for the search results.</mark>

### Split

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

**Description:** The **Split** action divides a text value into parts based on a specified delimiter.

**Usage:**

* **Source String**:
  * <mark style="color:green;">Enter the text value to be split.</mark>
* **Delimiter**:
  * <mark style="color:green;">Specify the separator for splitting the text.</mark>
* **Delimiter is**:
  * <mark style="color:green;">Choose options for matching case sensitivity.</mark>
* **Assign the output to the variable**:
  * <mark style="color:green;">Determine the variable for the split data.</mark>

### Substring

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

**Description:** The **Substring** action extracts a portion of a text value based on specified positions.

**Usage:**

* **Source String**:
  * <mark style="color:green;">Enter the text value to extract from.</mark>
* **Start From**:
  * <mark style="color:green;">Specify the starting position for extraction.</mark>
* **Length (Optional)**:
  * <mark style="color:green;">Specify the length of the extracted substring (optional).</mark>
* **Assign the output to the variable**:
  * <mark style="color:green;">Determine the variable for the extracted data.</mark>

### Trim

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

**Description:** The **Trim** action removes specified characters from the beginning or end of a text value.

**Usage:**

* **Source String**:
  * <mark style="color:green;">Enter the text value to be trimmed.</mark>
* **Trim from the beginning**:
  * <mark style="color:green;">Specify characters to remove from the start.</mark>
* **Trim from the end**:
  * <mark style="color:green;">Specify characters to remove from the end.</mark>
* **Assign the output to the variable**:
  * <mark style="color:green;">Determine the variable for the trimmed data.</mark>

### Uppercase

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

**Description:** The **Uppercase** action converts text data from lowercase to uppercase.

**Usage:**

* **Source String**:
  * <mark style="color:green;">Enter the text value to be converted.</mark>
* **Assign the output to variable**:
  * <mark style="color:green;">Determine the variable for the converted uppercase data.</mark>

***

## Additional Tips

### [**Use Cases**](/userguide/use-cases.md)

### [FAQ](/userguide/faq.md)


---

# 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.autommate.com/userguide/libraries/transform/string.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.
