Text

The Texts folder in Blockly is useful for manipulating text and contains Blocks that you will need to enable Misty's Text-To-Speech. These blocks can be used for basic text operations, such as concatenation, splitting, and searching. It also contains blocks for more advanced text operations, such as regular expression matching and text formatting.

The Texts folder also contains blocks for working with variables, functions, and conditional statements. This allows you to write complex text manipulation expressions in Blockly.

Text

This is a simple text block. By clicking on the text field you can start writing numbers, letters or strings. This is often used together with Misty's speech blocks.

Build text

With this block, you can create your own text blocks. Its different from the previous one because here you can combine variables and normal text. It means it can be used in functions and in more advanced applications for Misty.

By clicking on the gear icon you can join multiple items and build the text as long as you like.

Append text

With this block, you can add some text to a specified item, as well as other text blocks.

Other text block editors

These blocks provide a variety of functionalities and return different values:

  • The first block returns the length of the string.

  • The second block prints the string contained.

  • The third block returns true if the block is empty.

  • The fourth block changes everything in the blue box to UPPER CASE or lower case or Title Case.

  • The fifth block trims some space next to the block (both sides, right side or left side only). It can also be used for example next to variables in the build text block in order to create well-readable text.

Prompt the user for some text

The "Prompt for Text" block in Blockly is a feature that allows a program to request and receive text input from a user. When this block is used within a Blockly program and executed, it triggers an interface or dialogue that asks you to input text.

The purpose of this functionality is to have the robot give requests for input to the user.

Strings operators

These three blocks in Blockly provide operations with strings :

  • The first block returns the letter in a specified position, 0# is the first letter.

  • The second block returns a specified portion of the text.

  • The third block returns the index of the first, or last, occurrence of the first text in the second text. It returns -1 if the variable text is not found.

Note: Numbers written in the math blocks are "read" with their value, instead numbers written in the text strings are "read" as part of the language, in fact, in text strings type "five" gives exactly the same result as typing "5". This doesn't happen in the math blocks.

Last updated