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.
The Get Length operation allows you to return the number of characters of the text provided.
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.
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.
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.
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.
Operation | Information |
---|---|
Text | Result |
---|---|
Text | Index | Result |
---|---|---|
Text | Search | Result |
---|---|---|
Text | Search | Result |
---|---|---|
Operation | Information |
---|---|
Text | Start Index | End Index | Result |
---|---|---|---|
Text | Start Index | End Index | Result |
---|---|---|---|
Operation | Information |
---|---|
Text | Result |
---|---|
Text | Result |
---|---|
Text | Result |
---|---|
Operation | Information |
---|---|
Text | Search | Result |
---|---|---|
Text | Search | Result |
---|---|---|
Text | Search | Result |
---|---|---|
Text | Search | Result |
---|---|---|
Text | Search | Result |
---|---|---|
Operation | Information |
---|---|
Text | Search | Replacement | |
---|---|---|---|
Text | Search | Replacement | Result |
---|---|---|---|
Text | Search | Result |
---|---|---|
Text | Count | Result |
---|---|---|
Operation | Information |
---|---|
Text | Result |
---|---|
Text | Result |
---|---|
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.
Hello World!
12
BotGhost
8
Hello World!
0
H
Hello World!
1
e
Hello World!
7
o
BotGhost
4
h
Hello World!
e
1
Hello World!
World
6
Hello World!
BotGhost
-1
yes, goodbye
ye
0
Hello World!
o
7
Hello World!
Hello
0
Hello World!
BotGhost
-1
BotGhost is cool, isn't it?
is
18
Returns an extracted portion of text.
Returns an extracted portion of text.
Hello World
0
7
Hello W
Hello World
6
11
World
BotGhost
4
8
host
Hello World!
0
7
Hello W
Hello World!
6
11
World
BotGhost
4
8
host
Returns the text with all letter characters displaying in uppercase.
Returns the text with all letter characters displaying in lowercase.
Returns the text with no space characters (
) at the start or end of the string.
Hello World
HELLO WORLD
HELLO WORLD!
HELLO WORLD!
botghost
BOTGHOST
Hello World
hello world
HELLO WORLD!
hello world!
botghost
botghost
Hello World
Hello World
Hello World
Hello World
BotGhost
BotGhost
Returns true or false based on if the text includes a string.
Returns true or false based on if the text starts with a string.
Returns true or false based on if the text ends with a string.
Returns matches based on regular expressions.
Returns indexes based on regular expressions.
Hello World
World
true
Hello World
lo Wor
true
Hello World
o
true
Hello World
BotGhost
false
Hello World
He
true
Hello World
World
false
Hello World
BotGhost
false
Hello World
World
true
Hello World
He
false
Hello World
BotGhost
false
API Requests are Good
[A-Z]
A,P,I,R,G
This is a test, using regex to find the word test in a sentence.
\btest\b
test,test
This is a test to find numbers in a sentence. Since there are no numbers here, it will not return any matches
\b\d+\b
null
API Requests are Good
[A-Z]
A,P,I,R,G
This is a test, using regex to find the word test in a sentence.
\btest\b
test,test
This is a test to find numbers in a sentence. Since there are no numbers here, it will not return any matches
\b\d+\b
null
Returns the original text with a portion of it replaced.
Returns the original text with portions of it replaced.
Returns the original text divided into an array.
Returns the original text a specified number of times.
Hello World!
World
everyone
Hello everyone!
Hello World!
BotGhost
Hello BotGhost World!
Cats are cute
C
R
Rats are cute
Hello World
World
everyone
Hello everyone!
you are smart, aren't you?
you
we
we are smart, aren't we?
Bitter
t
l
Biller
20/04/2024
/
20,4,2024
docs.botghost.com
.
docs,botghost,com
Hello everyone!
c
Hello everyone!
ah
5
ahahahahah
Hello!
2
Hello! Hello!
Returns the original text surrounded by quotes (") with escaped quotes and line breaks.
Returns the original text with escaped quotes and line breaks.
Hello "World"!
"Hello \"World\"!"
Line Break
"Line\nBreak"
Not a line break \n
"Not a line break \\n"
Hello "World"!
Hello \"World\"!
Line Break
Line\nBreak
Not a line break \n
Not a line break \\n