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

# Text Formatter

## Text Formatter Block

The Text Formatter block provides a set of handy operations for string manipulation. All of the operations return a JSON with the result using the key `value`. The available options are:

### Encode/Decode (Action)

Encode or decode a string using UTF-8, Hex, or Base64 encoding.

* Input: String or variable to encode/decode
* To Encoding: Encoding type (UTF-8, Hex, or Base64)

**Example Input:**

```bash theme={null}
"Hello world!"
```

**To Encoding:**

```bash theme={null}
"Base64"
```

**Example Output:**

```json JSON theme={null}
{
  "value": "SGVsbG8gd29ybGQh"
}
```

### Include

Determine whether one string can be found within another string.

* Input: String or variable to search within
* Text: Text or variable to search for

**Example Input:**

```bash theme={null}
"This is a sample text."
```

**Text:**

```bash theme={null}
"sample"
```

**Example Output:**

```json JSON theme={null}
{
  "value": true
}
```

### URL Encode/Decode

URL encode or decode a string.

* Input: String or variable to encode/decode, usually a URL with characters in query params that need to be encoded
* Operation: Encode or Decode

**Example Input:**

```bash theme={null}
"https://example.com/search?q=hello world"
```

**Operation:**

```bash theme={null}
"Encode"
```

**Example Output:**

```json JSON theme={null}
{
  "value": "https%3A%2F%2Fexample.com%2Fsearch%3Fq%3Dhello%2520world"
}
```

### Upper Case

Convert all characters in a string to uppercase.

* Input: String or variable to convert

**Example Input:**

```bash theme={null}
"hello world"
```

**Example Output:**

```json JSON theme={null}
{
  "value": "HELLO WORLD"
}
```

### Lower Case

Convert all characters in a string to lowercase.

* Input: String or variable to convert

**Example Input:**

```bash theme={null}
"HELLO WORLD"
```

**Example Output:**

```json JSON theme={null}
{
  "value": "hello world"
}
```

### Random Text Generator

Randomly generate a 22-character long text.

**Example Output:**

```json JSON theme={null}
{
  "value": "aBcDeFgHiJkLmNoPqRsTuVw"
}
```

### Regex Fetch

Fetch data from the input using regular expressions.

* Input: String or variable to perform regex on
* Regular Expression: Standard regex syntax

**Example Input:**

```bash theme={null}
"The price is $42.50"
```

**Regular Expression:**

```bash theme={null}
"\\$[0-9]+\\.[0-9]{2}"
```

**Example Output:**

```json JSON theme={null}
{
  "value": true
}
```

### Split

Split text into a list.

* Input: String or variable to split
* Delimiter: Character to split on

**Example Input:**

```bash theme={null}
"value1,value2,value3"
```

**Delimiter:**

```bash theme={null}
","
```

**Example Output:**

```json JSON theme={null}
{
  "value": ["value1", "value2", "value3"]
}
```

### Join

Join a list into a single line of text.

Input: Pieces of data to join from the data picker

Separator: Character to place between the concatenated parts

**Example Input:**

```json JSON theme={null}
["John", "Doe"]
```

**Separator:**

```json JSON theme={null}
" "
```

**Example Output:**

```json JSON theme={null}
{
  "value": "John Doe"
}
```

### Slice from Start

Slice a string from a specified start index.

Input: String or variable to slice

Start Index: Index at which to start the slice

**Example Input:**

```json JSON theme={null}
"Hello world!"
```

**Start Index:**

```json JSON theme={null}
6
```

**Example Output:**

```json JSON theme={null}
{
  "value": "world!"
}
```

### Slice from End

Slice a specified number of characters from the end of a string.

Input: String or variable to slice

Number of Characters: Number of characters to remove from the end

**Example Input:**

```json JSON theme={null}
"Hello world!"
```

**Number of Characters:**

```json JSON theme={null}
6
```

**Example Output:**

```json JSON theme={null}
{
  "value": "Hello"
}
```

### Truncate

Convert a decimal number to a whole number.

Input: Decimal number or variable to truncate

**Example Input:**

```json JSON theme={null}
22.22
```

**Example Output:**

```json JSON theme={null}
{
  "value": 22
}
```

## What’s Next

After you've finished using the Text Formatter block, you can explore other utility blocks provided by Alloy. These utility blocks range from encryption and decryption utilities, list operations, data transformation, and more. You can also start to build complex workflows by combining different blocks according to your business requirements.
