Click or drag to resize

RAtLine Function

X#
Return the line number of the last occurrence of a substring within a multiline string.

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

Parameters

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

Return Value

Type: DWord
The position of the last occurrence of cSearch within cTarget.
If cSearch is not found, RAtLine() returns 0.
Remarks
RAtLine() returns the position of the last occurrence of a substring by searching the target string from the right.
Examples
This example uses RAtLine() to indicate that the last occurrence of "line" is on the third line:
X#
1LOCAL cBigString AS STRING
2cBigString := "This is the first line" + ;
3        _Chr(K_RETURN) + "This is the second line" + ;
4        _Chr(K_RETURN) + "This is the third line"
5? RAtLine("line", cBigString)                        // 3
See Also