User Manual
Print

Checking the Length of Text

Length of

				
					{"blocks":"<xml xmlns=\"https://developers.google.com/blockly/xml\"><block type=\"text_length\" disabled=\"true\" x=\"-23\" y=\"112\"><value name=\"VALUE\"><shadow type=\"text\" disabled=\"true\"><field name=\"TEXT\">Hello</field></shadow></value></block></xml>"}
				
			

This block is used to show the number of letters in the text.

Parameters: String

Output: Number

Sample code:

				
					{"blocks":"<xml xmlns=\"https://developers.google.com/blockly/xml\"><block type=\"pxt-on-start\" x=\"0\" y=\"0\"><statement name=\"HANDLER\"><block type=\"basic_consoleLogNum\"><value name=\"num\"><block type=\"text_length\"><value name=\"VALUE\"><shadow type=\"text\"><field name=\"TEXT\">Hello</field></shadow></value></block></value></block></statement></block></xml>"}
				
			

The output:

Length of - Output