User Manual
Print

Checking Whether the Text Contains Characters

Includes …

				
					{"blocks":"<xml xmlns=\"https://developers.google.com/blockly/xml\"><variables><variable>find</variable><variable>list</variable><variable>index</variable></variables><block type=\"string_includes\" disabled=\"true\" x=\"-22\" y=\"382\"><value name=\"this\"><shadow type=\"text\" disabled=\"true\"><field name=\"TEXT\">this</field></shadow></value><value name=\"searchValue\"><shadow type=\"text\" disabled=\"true\"><field name=\"TEXT\"/></shadow></value></block></xml>"}
				
			

This block is used to check whether the text contains the characters of the text.

Parameters: Screen Item/String

Output:Boolean (True/False)

Sample code:

				
					{"blocks":"<xml xmlns=\"https://developers.google.com/blockly/xml\"><variables><variable>text</variable></variables><block type=\"pxt-on-start\" x=\"0\" y=\"0\"><statement name=\"HANDLER\"><block type=\"variables_set\"><field name=\"VAR\">text</field><value name=\"VALUE\"><block type=\"text\"><field name=\"TEXT\">Hello World</field></block></value><next><block type=\"controls_if\"><mutation else=\"1\"/><value name=\"IF0\"><shadow type=\"logic_boolean\"><field name=\"BOOL\">TRUE</field></shadow><block type=\"string_includes\"><value name=\"this\"><shadow type=\"text\"><field name=\"TEXT\"/></shadow><block type=\"variables_get\"><field name=\"VAR\">text</field></block></value><value name=\"searchValue\"><shadow type=\"text\"><field name=\"TEXT\">World</field></shadow></value></block></value><statement name=\"DO0\"><block type=\"basic_consoleLogText\"><value name=\"text\"><block type=\"typescript_expression\"><field name=\"EXPRESSION\">\"World is inside the text.\"</field></block></value></block></statement><statement name=\"ELSE\"><block type=\"basic_consoleLogText\"><value name=\"text\"><block type=\"typescript_expression\"><field name=\"EXPRESSION\">\"World is not inside the text.\"</field></block></value></block></statement></block></next></block></statement></block></xml>"}
				
			

The output:

Includes - Output