Click or drag to resize

At3 Function

Return the position of the first occurrence of a substring within a string, starting at a specified position.

Namespace:  XSharp.Core
Assembly:  XSharp.Core (in XSharp.Core.dll) Version: 2.2a
Syntax
 FUNCTION At3(
	cSearch AS STRING,
	cTarget AS STRING,
	dwOffset AS DWORD
) AS DWORD
View Source

Parameters

cSearch
Type: String
The substring to search for.
cTarget
Type: String
The string in which to search.
dwOffset
Type: UInt32
The position in the string at which to start searching.  A value of zero corresponds to the first byte.

Return Value

Type: UInt32
The position of the first occurrence of <cSearch> within <cTarget>.  If <cSearch> is not found, At3() returns 0.
Remarks
At3() is the same as At(), except that you can specify an offset that tells where to start searching.
Examples
These examples show typical uses of At3():
X#
? At3("a", "abcdeabc", 2)                // 6
? At3("a", "bcde", 1)                // 0
This example displays the position of every occurrence of a string within the source:
X#
LOCAL dwOffset  AS DWORD
LOCAL dwFound := 1 AS DWORD
LOCAL cSource AS STRING
LOCAL cSearch AS STRING
cSource := "Now know-how is valued"
cSearch := "ow"
DO WHILE dwFound != 0
        ? dwFound := At3(cSearch, cSource, wOffset)
        dwOffset := dwFound + SLen(cSearch)
END
See Also