(Formerly known as global function StrContains, which is now obsolete)
(Formerly known as String.Contains, which is now obsolete)
String.IndexOf(string needle)
Checks to see if NEEDLE is contained within the specified string. Returns the character position
of the match if it is, or -1 if it is not.
This function is not case sensitive; ie. testing "test string" for "sTRiN" would match.
Example:
String haystack = "The haystack had a needle in it somewhere.";
int result = haystack.IndexOf("a needle");
if (result == -1) {
Display("The string didn't contain the needle.");
}
else {
Display("a needle was found starting at character %d in the string.", result);
}
See Also: String.EndsWith,
String.StartsWith
|