User Manual
Print

Showing Text in Substring Format

Substring of … from … to length …

				
					{"blocks":"<xml xmlns=\"https://developers.google.com/blockly/xml\"><block type=\"string_substr\" disabled=\"true\" x=\"-22\" y=\"517\"><value name=\"this\"><shadow type=\"text\" disabled=\"true\"><field name=\"TEXT\">this</field></shadow></value><value name=\"start\"><shadow type=\"math_number\" disabled=\"true\"><field name=\"NUM\">0</field></shadow></value><value name=\"length\"><shadow type=\"math_number\" disabled=\"true\"><field name=\"NUM\">10</field></shadow></value></block></xml>"}
				
			

This block is used to show the substring from the selected text.

Parameters: Screen Item/String

Condition: Number (Default: 0 and 10)

Output: String

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_consoleLogText\"><value name=\"text\"><block type=\"string_substr\"><value name=\"this\"><shadow type=\"text\"><field name=\"TEXT\"/></shadow><block type=\"typescript_expression\"><field name=\"EXPRESSION\">\"Hello World\"</field></block></value><value name=\"start\"><shadow type=\"math_number\"><field name=\"NUM\">0</field></shadow></value><value name=\"length\"><shadow type=\"math_number\"><field name=\"NUM\">10</field></shadow></value></block></value></block></statement></block></xml>"}
				
			

The output:

Substring of - Output