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.21
Syntax FUNCTION RAtLine(
cSearch AS STRING,
cTarget AS STRING
) AS DWORD
public static uint RAtLine(
string cSearch,
string cTarget
)
Request Example
View SourceParameters
- 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:
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)
See Also