---
title: Text and binary functions
slug: text-and-binary-functions
description: Modify and transform data using text and binary functions.
image: https://archbee-image-uploads.s3.amazonaws.com/oAyFj2GHlBeBVWF5OAir2/Nn_KXtneqFeXxYS5wYmXW_domino-zoomin-purple-a-1.png
docTags: 
createdAt: 2025-02-03T13:29:15.598Z
---

Text and binary functions let you modify and transform data. Use a string function to change capitalization, remove diacritics and accents marks, combine, or split text. Use binary functions to encode or decode raw data.

Below is a list of supported text and binary functions and an example of each.

## ascii

**ascii (text; \[remove diacritics])**

Removes all non-ascii characters from a text string.

```none
ascii( ěMščařžkýáeíé)
= Make
```

```none
ascii( ěščřž ; true )
= escrz
```

## base64

**base64 (text)**

Transforms text to base64.

```none
base64( Make )
=TWFrZQ==
```

Combine the `toBinary()` and `toString()` functions to transform base64 encoded text to plain text, as seen below:

```none
toString( toBinary( TWFrZQ== ; base64 ) )
= Make
```

## capitalize

**capitalize (text)**

Converts the first character in a text string to uppercase.

```none
capitalize(make)
= Make
```

## contains

**contains (text; search string)**

Verifies if text contains the search string.

```none
contains( Hello World ; Hello )
= true
```

```none
contains( Hello World ; Bye )
= false
```

## decodeURL

**decodeURL (text)**

Decodes special characters in URL to text.

```none
decodeURL( Automate%20your%20workflow )
= Automate your workflow
```

## encodeURL

**encodeURL (text)**

Encodes special characters in a text to a valid URL address.

## escapeHTML

**escapeHTML (text)**

Escapes all HTML tags in text.

```none
escapeHTML( <b>Hello</b> )
= &lt;b&gt;Hello&lt;/b&gt;
```

## escapeJSON

**escapeJSON(text)**

Escapes special characters (like quotes and backslashes) so text can be safely used in JSON without causing errors.

```none
escapeJSON(He yelled, "Run!" and left.)  
= He yelled. \"Run!\" and left.
```

```none
escapeJSON(C:\Users\Admin) 
= C:\\Users\\Admin
```

## escapeMarkdown

**escapeMarkdown(text)**

Escapes all Markdown tags in text.

```none
escapeMarkdown("# Header") 
= &#35; Header
```

## indexOf

**indexOf (string; value; \[start])**

Returns the position of the first occurrence of a specified value in a string. This method returns '-1' if the value searched for never occurs.

```none
indexOf(Make; k )
= 2
```

```none
indexOf(We love Make ; x )
= -1
```

```none
indexOf(We love Make ; e ; 7 )
= 11
```

## length

**length (text or buffer)**

Returns the length of text string (number of characters) or binary buffer (buffer size in bytes).

```none
length( hello )
= 5
```

## lower&#x20;

lower (text)

Converts all alphabetical characters in a text string to lowercase.

```none
lower( Hello )
= hello
```

## md5

**md5 (text)**

Calculates the md5 hash of a string.

```none
md5(Make)
= 529a05ca6c1263aab080ec4f20754411
```

## replace (text; search string; replacement string)

Replaces the search string with the new string.

```none
replace( Hello World ; Hello ; Hi )
= Hi World
```

Regular expressions (enclosed in `/.../`) can be used as search string with a combination of flags (like `g`, `i`, `m`) appended:

```none
replace ( All these numbers 187 23 1 9565 will be replaced with X ; /\d+g ; X )
= All these numbers X X X X will be replaced with X
```

The replacement string can include the following special replacement patterns:

- `$&`= Inserts the matched substring
- `$n` = Where n is a positive integer less than 100, inserts the nth parenthesized submatch string. Note that this is 1-indexed

```none
replace ( Phone number is 777111222 ; /\d+g ; $& )
Phone number is +420777111222
```

```none
replace ( Phone number is 777111222 ; / is (d) ;:  +42$1 )
Phone number is +420777111222
```

:::hint{type="info"}
Do not use named capture groups like `/ is (?<number>\d+)/` in the replacement string argument as this will throw an error.
:::

## replaceEmojiCharacters

**replaceEmojiCharacters (text)**

Replaces emoji characters with the new string.

::Image[]{src="https://api.archbee.com/api/optimize/oAyFj2GHlBeBVWF5OAir2/kC1u7Vv0tDpS7vPdK_OqK_uuid-91fe7ca8-1d92-216e-27ec-adf48c78c5af.png" size="80" width="588" height="129" position="flex-start" alt="Replace Emoji" darkWidth="588" darkHeight="129" showCaption="false"}

## sha1

**sha1 (text; \[encoding]; \[key])**

Calculates the sha1 hash of a string. If the key argument is specified, sha1 HMAC hash is returned instead. Supported encodings: *hex* (default), *base64* or *latin1*.

```none
sha1(Make)
= a94431ee22f05f141107f9355ed3127d0f0c4d5a
```

## sha256

**sha256 (text; \[encoding]; \[key]; \[key encoding])**

Calculates the sha256 hash of a string. If the key argument is specified, sha256 HMAC hash is returned instead. Supported encodings: *hex* (default), *base64* or *latin1*.

```none
sha256(Make)
= ccdd25d4230fb997a7ee1166f8afabd157248eb812ea55ec7c3d1b7c8af7fa11
```

## sha512

**sha512 (text; \[output encoding]; \[key]; \[key encoding])**

Calculates the sha512 hash of a string. If the key argument is specified, sha512 HMAC hash is returned instead. Supported encodings: *hex* (default), *base64* or *latin1*. Supported key encodings: *text* (default), *hex*, *base64* or *binary*. When using *binary* key encoding, a key must be a buffer, not a string.

```none
sha512(Make)
= e8000cd0fb8fae18caa8daa677269b0034380d3ec549e0113a0722d8b8dc05b0f7037f33f32fa09f906b2f1d7c43f2689a55d79aadf6bf09dd93f79407424d34
```

## split

**split (text; separator)**

Splits a string into an array of strings by separating the string into substrings.

```none
split( John, George, Paul ; , )
= 
John
George
Paul
```

## startcase

**startcase (text)**

Capitalizes the first letter of every word and lower cases all other letters.

```none
startcase( hello WORLD )
= Hello World
```

## stripHTML

### stripHTML (text)

Removes all HTML tags from text.

```none
stripHTML( <b>Hello</b> )
= Hello
```

## substring

**substring (text; start; end)**

Returns a portion of a text string between the "start" position and "the end" position.

```none
substring( Hello ; 0 ; 3 )
= Hel
substring( Hello ; 1 ; 3 )
= el
```

## toBinary

### toBinary (value)

Converts any value to binary data. You can also specify encoding as a second argument to apply binary conversions from hex or base64 to binary data.

```none
toBinary(Make)
= 4d 61 6b 65
```

## toString

### toString (value)

Converts any value to a string.

```none
toString(toBinary(TWFrZQ==;base64)
= Make
```

## trim

**trim (text)**

Removes space characters at the start or end of the text.

## upper

**upper (text)**

Converts all alphabetical characters in a text string to uppercase.

```none
upper( Hello )
= HELLO
```

