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.21
Syntax FUNCTION At3(
cSearch AS STRING,
cTarget AS STRING,
dwOffset AS DWORD
) AS DWORD
public static uint At3(
string cSearch,
string cTarget,
uint dwOffset
)
Request Example
View SourceParameters
- 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 corresponds to the first byte.
Return Value
Type:
DWord
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():
1? At3("a", "abcdeabc", 2)
2? At3("a", "bcde", 1)
This example displays the position of every occurrence of a string within the source:
1LOCAL dwOffset<br />
2AS DWORD
3LOCAL dwFound := 1 AS DWORD
4LOCAL cSource AS STRING
5LOCAL cSearch AS STRING
6cSource := "Now know-how is valued"
7cSearch := "ow"
8DO WHILE dwFound != 0
9 ? dwFound := At3(cSearch, cSource, wOffset)
10 dwOffset := dwFound + SLen(cSearch)
11END
See Also