Skip to content

Text ​

Here are some examples of text:

  • "thing #1"
  • "March 12, 2010"
  • "" (an empty string)

Text can contain uppercase or lowercase letters, numbers, punctuation, other symbols, and spaces between words.

text

Create text with ​

The create text with block joins (concatenates) the values of several strings to build a new string.

text_join

Python ​

python
'' + str(A) + str(B) + str(C)

Append text ​

The append text block adds the given text to the specified variable.

text_append

Python ​

python
VAR = str(VAR) + TEXT

Length of text ​

The length of block counts the letters, numbers, and other characters in a string and returns the total length.
The length of abc below is 3, and the length of an empty string is 0.

text_length

Python ​

python
len(VALUE)

Is empty ​

The is empty block checks whether the given string is empty (that is, whether its length is 0).

text_isEmpty

Python ​

python
len(VALUE) == 0

Find text ​

These blocks check whether one string occurs inside another and, if it does, return its position.

text_indexOf

Python ​

python
(VALUE.find(FIND) + 1)
(VALUE.rfind(FIND) + 1)

Get a single letter ​

Gets one character at a specific position in a string.
There are several options: first, last, random, and letter #N.

text_charAt

Python ​

python
TEXT[N - 1]
TEXT[len(TEXT) - N]
TEXT[0]
TEXT[-1]
TEXT[int(random.random() * len(TEXT))]

Get substring ​

The get substring block lets you extract a specific range of a string.

text_getSubstring

Python ​

python
TEXT[at1:at2]

Change letter case ​

This block converts the input string into one of the following forms:

  • UPPER CASE: converts every letter to uppercase
  • lower case: converts every letter to lowercase
  • Title Case: capitalizes the first letter of each word and lowercases the rest
text_changeCase

Python ​

python
TEXT.upper() # UPPER CASE
TEXT.lower() # lower case
TEXT.title() # Title Case

Trim whitespace ​

The following block removes whitespace from a string at these positions:

  • both sides
  • left side
  • right side
text_trim

Python ​

python
TEXT.strip()    # both sides
TEXT.lstrip()   # left side
TEXT.rstrip()   # right side

Count occurrences in text ​

Counts and returns how many times a specific substring appears in the given string.

text_count

Python ​

python
HAYSTACK.count(NEEDLE)

Replace text ​

Replaces every occurrence of a specific substring in a string with another string.

text_replace

Python ​

python
HAYSTACK.replace(NEEDLE, REPLACEMENT)

Reverse text ​

Returns a new string with the order of the characters reversed.

text_reverse

Python ​

python
TEXT[::-1]

Print text ​

The print block shows the input value in a popup window.

text_print

Python ​

python
print(TEXT)

Get user input ​

The following block creates a popup window that asks the user for input, and the entered value is stored in a variable.
You can accept either text or a number.

text_prompt_ext

Python ​

python
input(TEXT)
float(input(TEXT))