Documentation

Una is developed by Una Technologies Limited

All rights reserved

© 2022 Una Technologies Limited

Print

Finding the Position of the Character

Find index of …

				
					{"blocks":"<xml xmlns=\"https://developers.google.com/blockly/xml\"><variables><variable>text</variable></variables><block type=\"string_indexof\" disabled=\"true\" x=\"-22\" y=\"427\"><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 find the position of the first occurrence of the value in the text.

Parameters: Screen Item/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=\"string_indexof\"><value name=\"this\"><shadow type=\"text\"><field name=\"TEXT\">this</field></shadow></value><value name=\"searchValue\"><shadow type=\"text\"><field name=\"TEXT\">s</field></shadow></value></block></value></block></statement></block></xml>"}
				
			

The output:

Find Index of - Output
Previous Checking Whether the Text Contains Characters
Next Checking Text is Empty or Not