Manipulate some text
Last updated
Last updated
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.
The text to perform manipulations on. All Variables can be used in this field.
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.
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.
The Get Length operation allows you to return the number of characters of the text provided.
Hello World!
12
BotGhost
8
The Character At operation returns the character at the specified 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.
Hello World!
0
H
Hello World!
1
e
Hello World!
7
o
BotGhost
4
h
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.
Hello World!
e
1
Hello World!
World
6
Hello World!
BotGhost
-1
yes, goodbye
ye
0
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.
The text to find the last index of. This input is case sensitive. All Variables can be used in this input.
Hello World!
o
7
Hello World!
Hello
0
Hello World!
BotGhost
-1
BotGhost is cool, isn't it?
is
18
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.