# 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.

<figure><img src="/files/YlFaJtYEt79yKYPAvkF8" alt=""><figcaption><p>text blocks</p></figcaption></figure>

<figure><img src="/files/Ppk04tMH9HW2aVJkXyXZ" alt=""><figcaption><p>text blocks</p></figcaption></figure>

### Text

<figure><img src="/files/UiMcLVpn3trgG9zlJ6r8" alt=""><figcaption><p>text block</p></figcaption></figure>

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.&#x20;

### Build text

<figure><img src="/files/lbKObno4nhsUPA9lfaNh" alt=""><figcaption><p>build text block</p></figcaption></figure>

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

<figure><img src="/files/k8j3lb1UpxFNdb4e4Wrd" alt=""><figcaption><p>append text in Misty Studio</p></figcaption></figure>

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

### Other text block editors

<figure><img src="/files/1UsYsn7erOXp0zHhPAcZ" alt=""><figcaption><p>other text editor blocks</p></figcaption></figure>

These blocks provide a variety of functionalities and return different values:&#x20;

* 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.&#x20;

### Prompt the user for some text&#x20;

<figure><img src="/files/ovx1as3W5g98wiiuBb0V" alt=""><figcaption><p>prompt for user for some text block</p></figcaption></figure>

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

<figure><img src="/files/bZKmAFjnBeAIbudjKsdk" alt=""><figcaption><p>strings operators blocks</p></figcaption></figure>

These three blocks in Blockly provide operations with strings :&#x20;

* 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.*&#x20;


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://lessons.mistyrobotics.com/blockly-elements/basic-blocks/text.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
