May 04

Check Array for String Function (isInArray)

Checks to see if a string is in an array

function isInArray(arrIn,strIn,matchCase)
	isInArray = FALSE
	if isArray(arrIn) and not isnull(strIn) then
		for i = 0 to ubound(arrIn)
			if matchCase then
				if arrIn(i) = strIn then
					isInAray = TRUE
					exit function
				end if
			else
				if lcase(arrIn(i)) = lcase(strIn) then
					isInAray = TRUE
					exit function
				end if
			end if
		next
	end if
end function

Permanent link to this article: https://www.wperry.net/code/isinarray/

Leave a Reply

Your email address will not be published.