Text

Texts Examples of texts are:

“Thing 1”
“12. March 2010”
“” (empty text)
Text can contain letters (capital or lower case), numbers, punctuation marks, other symbols, and spaces.

Blocks

Creating text

The following block creates the text “Hello” and saves it in the variable named greeting:

Bild1_e.PNG

The block create text with combines the value of the variable greeting and the new text “world” to create the text “Helloworld.” Please note that there is no space between the two texts, since there was none in the original texts.

Bild2_e.PNG

To increase the number of text inputs, click the (+) symbol. To remove the last output, click the (-) symbol.

Changing text

The block to ... append adds the entered text to the given variable. In this example, it changes the value for the variable greeting from “Hello” to “Hello, there!”:

Bild4_e.PNG

Text length

The length of block counts the number of characters (letters, numbers, etc.) contained in a text. The length of “We are #1!” is 12, and the length of the empty text is 0.

Bild5_e.PNG

Bild6_e.PNG

Check for empty text

This is empty block checks whether the entered text is empty (the length is 0). The result is true in the first example, and false in the second example.

Bild7_e.PNG

Bild8_e.PNG

Search for text

These blocks can be used to check whether a text is present in another text, and if so, where. For example, this block checks for the first occurrence of “e” in “Hello,” and the result is 2:

Bild9_e.PNG

This one checks for the last occurrence of “e” in Hello, which is also 2:

Bild10_e.PNG

Regardless of whether the first or last occurrence is selected, this block delivers the result 0, since “Hello” does not contain a “z.”

Bild11_e.PNG

Extracting text

Extracting a single character

This returns “b,” the second letter in “abcde”:

Bild12_e.PNG

This returns “d,” the next to last letter in “abcde”:

Bild13_e.PNG

This returns “a,” the first letter in “abcde”:

Bild14_e.PNG

This returns “e,” the last letter in “abcde”:

Bild15_e.PNG

This contains each of the 5 letters in “abcde” with the same probability:

Bild16_e.PNG

None of them changes the text from which these results are extracted.

Extracting a text range

The in text ... get substring from block can be used to extract a text range that either starts with:

and ends with:

In the following example, “abc” is extracted:

Bild17_e.PNG

Change text capitalization

This block generates a version of the input text either written in

The result of the following block is “HELLO”:

Bild18_e.PNG

Non-alphabetic characters are not affected. Please note that this block does not work on text in languages without capital and lower case letters, like Chinese.

Trimming (removing) spaces

The following block removes spaces, depending on the settings in the drop down menu (small triangle):

The result of the following block is “Hi you.”

Bild19_e.PNG

Spaces in the middle of the text are not affected.

Print text

The print block causes the input value in the console window to be printed:

Bild20_e.PNG

It is never sent to the printer, although the name might seem to indicate this.

Output text with formatting

You can use the formatted text block to output texts with formatted variable content. All place holders {} in the text are replaced with the content of the variables appended after the text. Formatting can be entered into the brackets. The formatting {:.1f}, for instance, outputs only the first decimal place in the variable t.

image-1638518243441.png


Revision #2
Created 21 February 2022 15:50:52 by Admin
Updated 9 January 2023 10:40:20 by Alexander Steiger