© Pradeeka Seneviratne  2019
Pradeeka SeneviratneBBC micro:bit Recipeshttps://doi.org/10.1007/978-1-4842-4913-0_4

4. Working with Text

Pradeeka Seneviratne1 
(1)
Udumulla, Mulleriyawa, Sri Lanka
 

MakeCode has many blocks to offer when it comes to manipulating text strings. In this chapter you will learn how to find the length of a text, joining together any number of pieces of text, comparing two strings, extracting a part from a string, converting a string to a number, and extracting a character from a string at the specified index.

4-1. Finding the Length of a Text

Problem

You want to find the length of a text.

Solution

  • In the Toolbox, click on the Basic category. Then click and drag the show number block over, and place it inside of the on start block. ...

Get BBC micro:bit Recipes: Learn Programming with Microsoft MakeCode Blocks now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.