Click or drag to resize

Occurs3 Function

X#
Return the number of times a substring occurs in a string, starting at a specified position.

Namespace:  XSharp.Core
Assembly:  XSharp.Core (in XSharp.Core.dll) Version: 2.19
Syntax
 FUNCTION Occurs3(
	cSearch AS STRING,
	cTarget AS STRING,
	dwOffset AS DWORD
) AS DWORD
Request Example View Source

Parameters

cSearch
Type: String
The substring to search for.
cTarget
Type: String
The string in which to search.
dwOffset
Type: DWord
The position in the string at which to start searching.
A value of zero (0) specifies the first byte.

Return Value

Type: DWord
The number of times that cSearch appears in cTarget.
Remarks
Occurs3() is the same as Occurs(), except that you can specify an offset that tells where to start searching. See Occurs() for more information.
Examples
This example show typical use of Occurs3():
X#
1LOCAL cSearch AS STRING
2LOCAL cTarget AS STRING
3cSearch := "any"
4cTarget := "Anything goes anyway anytime."
5? Occurs3(cSearch,cTarget,18)        // 1
See Also