Manipulate some text

Manipulate some text Action Block

With the 'Manipulate some text' block you are able to provide a text and perform text operations like getting the length of the text, trimming text or checking if the text starts or ends with another string.

Text

The text to perform manipulations on. All Variables can be used in this field.

Text Parameter of the Manipulate some text block

Text Operation

The type of text manipulation to perform on the provided Text string. There are several operations to choose from. Below you can find detailed information about each operation and how it can be used.

You can see a list of string methods in the action, or view more detailed descriptions.

Operation
Information

Returns the number of characters in the string.

Returns the character at the position of the specified index in the string.

Returns the index position of the first appearance of a specified query in the string.

Returns the index position of the last appearance of a specified query in the string.


Get Length

The Get Length operation allows you to return the number of characters of the text provided.

Examples

Text
Result

Hello World!

12

BotGhost

8

Character At

The Character At operation returns the character at the specified index.

Index

The position of the character in the string that you'd like to return. Indexes start at 0. All Variables can be used in this input.

Text Operation - Index of the Manipulate some text block

Examples

Text
Index
Result

Hello World!

0

H

Hello World!

1

e

Hello World!

7

o

BotGhost

4

h


Index Of

The Index Of operation returns the index of the first character of the given portion of text. If there are multiple matches, the first match is returned. If there are no matches, -1 is returned.

The text to find the index of. This input is case sensitive. All Variables can be used in this input.

Examples

Text
Search
Result

Hello World!

e

1

Hello World!

World

6

Hello World!

BotGhost

-1

yes, goodbye

ye

0


Last Index Of

The Last Index Of operation returns the index of the first character of the given portion of text. If there are multiple matches, the last match is returned. If there are no matches, -1 is returned.

Search

The text to find the last index of. This input is case sensitive. All Variables can be used in this input.

Examples

Text
Search
Result

Hello World!

o

7

Hello World!

Hello

0

Hello World!

BotGhost

-1

BotGhost is cool, isn't it?

is

18

Variable

The Variable field allows you to name the variable that can be used in other Actions and Conditions that follow this action block in the same command or event. You can use the clipboard icon under Result Variable to copy this variable to your device's clipboard.

If the variable used in this field already has a value, the previous value will be overwritten and cannot be accessed again.

Last updated

Was this helpful?