Meta Project

The Unofficial Meta Documentation

FIND

Summary

FIND Looking for the occurrence of a substring within a string.

Category

Categoryname

Usage

FIND value1 value1

Arguments

value1 - String that you want to check for the presence of a certain substring

value2 - Substring to look for.

Refinements

Combined refinements are to be used in the given order.

/CASE - Case sensitive

/HERE - The item sought should be on the first position

/LAST - Find the last occurence of the substring

/TAIL - positions the result directly after the found item.

/HERE/CASE - Combination

/HERE/TAIL - Combination

/HERE/TAIL/CASE - Combination

/LAST/CASE - Combination

/LAST/TAIL - Combination

/LAST/TAIL/CASE - Combination

/TAIL/CASE - Combination

Description

FIND

Example Code

Besides looking for a substring of multiple characters, FIND can be useful to check for certain data.

string: "DECAFBAD"
hexadecimal-number?: true
for index count string [
	character: copy cut at string index 1
	found: FIND "0123456789ABCDEF" character
	unless found [
		hexadecimal-number?: false
	]
]
write "String " write string write " is"
write either hexadecimal-number? [""][" not"]
write/line " a hexadecimal number"

Related

AT  
COPY  

Back to the Meta Methods Reference index