Click or drag to resize

Instr Function

Indicate whether a substring is contained in a string.

Namespace:  XSharp.Core
Assembly:  XSharp.Core (in XSharp.Core.dll) Version: 2.5
Syntax
 FUNCTION Instr(
	cSearch AS STRING,
	cTarget AS STRING
) AS LOGIC

Parameters

cSearch
Type: String
The substring to search for.
cTarget
Type: String
The string in which to search.

Return Value

Type: Boolean
TRUE if the substring was found; otherwise, FALSE.
Remarks
InStr() is a strongly typed version of the $ operator.
Examples
This example uses InStr() to indicate if a specific substring is part of a longer string:
X#
1LOCAL cSearch AS STRING
2LOCAL cTarget AS STRING
3cSearch := "Bend"
4cTarget := "Indian Bend Road"
5IF InStr(cSearch, cTarget)
6    ? "Found It"
7END
See Also