Click or drag to resize

RAtLine Function

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.2a
Syntax
 FUNCTION RAtLine(
	cSearch AS STRING,
	cTarget AS STRING
) AS DWORD
View Source

Parameters

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

Return Value

Type: UInt32
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#
LOCAL cBigString AS STRING
cBigString := "This is the first line" + ;
                _Chr(K_RETURN) + "This is the second line" + ;
                _Chr(K_RETURN) + "This is the third line"
? RAtLine("line", cBigString)                                                // 3
See Also