Strings

Edit

Introduction #

String in a programming language is a sequence of characters. It is used to represent text rather than numbers.
Strings are contained within a pair of double quotes, i.e. "Cat" or "Hello World".
Strings can contain numbers, however you must realize that "5" doesn’t have the value of 5, it has the value of 0, the same as "a" does.
You cannot add strings either, i.e. "12" + "34" isn’t "46", it’s "1234". 12 + 34 is 46.
If you wish to convert a string to a number, you can use String to Number command.


Edit

String Position #

Returns the position of the first occurrence of a specified value in a string. Case sensitive.
Returns 0 if it doesn’t find any match.

Box Name Type Description
Variable String Variable name to save the position
String String String to search inside of
Position of String Value to search for
From Location Number What position in the string to start the search at, default is 0
Case Insensitive Checkbox If this is checked, it will replace the first matching value, regardless of case.
Value to search for String From Location Case Insensitive Position returned
hello hello and hello world 0 Unchecked 1
hello Hello and hello world 0 Unchecked 11
hello Hello and hello world 0 Checked 1
hello Hello and Hello world 0 Unchecked 0
hello Hello and Hello world 0 Checked 1
hello hello and hello world 5 Unchecked 11 (finds the second hello since we’re searching from the 5th letter in the string)


Edit

String Get Character Length #

Returns the length of a string.

Box Name Type Description
Variable String Variable name to save returned value.
String Variable String Variable name containing the string.
String Length returned
Hello 5
”” 0


Edit

String Count #

Returns the number of occurrences of a character/string within a string. Case sensitive.

Box Name Type Description
Variable String Variable name to save result.
String String String to look at
Count String or Number Specify a character or a string you want to count inside the specified string
Case Insensitive Checkbox If this is checked, it will replace the first matching value, regardless of case.
Value to search for String Case Insensitive Result
Ab AbAbabAb Unchecked 3
Ab AbAbabAb Checked 4
33 333 and 33 and 33333 Unchecked 7
black Mr.Black has a black car and a black cat. Unchecked 2
black Mr.Black has a black car and a black cat. Checked 3


Edit

String Clamp #

Extracts a part of a string and returns the extracted part.
You need to specify the index of the first character and the amount of characters to extract.

Box Name Type Description
Variable String Variable name to save the clamped string.
String String String to clamp
Start Position Int Where to start the clamp
Amount Int Amount of characters to include in the clamp
Original string Start Amount Result
Hello World! 0 5 Hello
This is cool! 9 4 cool


Edit

String Remove Section #

Removes a part of a string and returns the remaining string. This is the opposite of String Clamp.
You need to specify the starting position and amount of characters to remove.

Box Name Type Description
Variable String Variable name to save the clamped string.
String String String to clamp
Start Position Int Where to start the clamp
Amount Int Amount of characters to remove
Original string Start Amount Result
Hello World! 6 10 Hello
Hello World! This is a nice day. 6 6 Hello! This is a nice day.
Lioran and Melonax is cool! 1 11 Melonax is cool!


Edit

String Replace All #

Searches a string for a specified value and replaces it with another specified string. All occurrences will be replaced.

Box Name Type Description
Variable String Variable name to save the string.
String String String to look into
Replace this String The value to search for to be replaced
With this String The value to replace the search value with. Can be empty to completely remove it.
Case Insensitive Checkbox If this is checked, it will replace the first matching value, regardless of case.
Value to search for Value to replace it with String Case Insensitive Result
l / Hello Unchecked He//o
  - Hello World and Hello World Unchecked Hello-World-and-Hello-World
hello goodbye Hello and hello and hello Unchecked Hello and goodbye and goodbye
hello goodbye Hello and hello and hello Checked goodbye and goodbye and goodbye


Edit

String Replace #

Searches a string for a specified value and replaces it with another specified string. Only the first occurrence will be replaced.

Box Name Type Description
Variable String Variable name to save the string.
String String String to look into
Replace this String The value to search for to be replaced
With this String The value to replace the search value with. Can be empty to completely remove it.
Case Insensitive Checkbox If this is checked, it will replace the first matching value, regardless of case.
Value to search for Value to replace it with String Case Insensitive Result
l / Hello Unchecked He/lo
  - Hello World and Hello World Unchecked Hello-World and Hello World
hello goodbye Hello and hello and hello Unchecked Hello and goodbye and hello
hello goodbye Hello and hello and hello Checked goodbye and hello and hello


Edit

String Lower Case #

Converts a string to lowercase letters.

Box Name Type Description
Variable String Variable name to save the converted string.
String String String to convert to lower case letters
Original String Returned String
HELLO World hello world


Edit

String Upper Case #

Converts a string to uppercase letters.

Box Name Type Description
Variable String Variable name to save the converted string.
String String String to convert to upper case letters
Original String Returned String
hello world HELLO WORLD


Edit

String Letters & Digits #

Removes all symbols from a string (including spaces), leaving only letters and digits.

Box Name Type Description
Variable String Variable name to save the converted string.
String Variable String Variable name containing the string.
Original String Processed String
!Hello123@ Hello123
$12.50 12.50
Hi! How are you? HiHowareyou


Edit

String Digits only #

Removes all letters and special symbols from a string (including spaces), leaving only digits.

Box Name Type Description
Variable String Variable name to save the converted string.
String Variable String Variable name containing the string.
Original String Processed String
Hello  
1a2b3c 123
$12.50 12.50


Edit

String Letters only #

Removes all digits and special symbols from a string (including spaces), leaving only letters.

Box Name Type Description
Variable String Variable name to save the converted string.
String Variable String Variable name containing the string.
Original String Processed String
!Hello123@ Hello
$12.50 USD USD
12345  
Hi! How are you? HiHowareyou


Edit

String Format #

Divides a string into multiple lines.
Very useful command to use together with Math: Trigger Pull for Bits or Redeem points with a message. You can force the viewer’s message to be split into multiple lines in your Text GDI+ source.

Box Name Type Description
Variable String Variable name to save the formatted string
String String String to format. Use /$variable$/ if your string is inside another variable.
Character per line String The maximum amount of characters per line.
Min Cutoff Length String The minimum amount of letters a word should be before allowing it to be cut it in the middle.


Edit

String Hash #

Hashes a string using one of the selected algorithms.

Hashing is a cryptographic process that can be used to validate the authenticity and integrity of various types of input. It is widely used in authentication systems to avoid storing plaintext passwords in databases, but is also used to validate files, documents and other types of data.
You can read more about hashing in this article.

Box Name Type Description
Text String String to hash
Variable String Variable to save the result
Type Dropdown menu Select which algorithm to use to hash


Edit

URL Encode String #

Encodes a URI by replacing each instance of certain characters by one, two, three, or four escape sequences representing the UTF-8 encoding of the character. Useful for using HTTP Request command as browsers do this part automatically for you.

Box Name Type Description
     


Edit

String Split to Array #

Splits a string value into an array.

Box Name Type Description
String (text) String The string you want to be split into an array.
Separator Symbol Separating symbol for the array. Defaults to ‘,’.
Array Name String Name of the array to save the split string as.