User Manual
Print

Checking Text is Empty or Not

Is empty

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

This block is used to check whether the text is empty.

Parameters: Screen Item/String

Output: Boolean (True/False)

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=\"controls_if\"><mutation else=\"1\"/><value name=\"IF0\"><shadow type=\"logic_boolean\"><field name=\"BOOL\">TRUE</field></shadow><block type=\"string_isempty\"><value name=\"this\"><shadow type=\"text\"><field name=\"TEXT\"/></shadow></value></block></value><statement name=\"DO0\"><block type=\"basic_consoleLogText\"><value name=\"text\"><block type=\"typescript_expression\"><field name=\"EXPRESSION\">\"There is nothing inside.\"</field></block></value></block></statement><statement name=\"ELSE\"><block type=\"basic_consoleLogText\"><value name=\"text\"><block type=\"typescript_expression\"><field name=\"EXPRESSION\">\"There is something inside.\"</field></block></value></block></statement></block></statement></block></xml>"}
				
			

The output:

Is Empty - Output