Summary
Returns the position of the last occurrence in the specified string
of the given search string.
- Assembly
- NAnt
.Core .dll - Namespace
- NAnt
.Core .Functions - Containing Type
- StringFunctions
Syntax
[Function("last-index-of")]
public static int LastIndexOf(string source, string value)
Examples
string::last-index-of('testing string', 'test') ==> 0
string::last-index-of('testing string', '') ==> 13
string::last-index-of('testing string', 'Test') ==> -1
string::last-index-of('testing string', 'ing') ==> 11
Remarks
This function performs a case-sensitive word search using the
invariant culture.
Attributes
Type | Description |
---|---|
FunctionAttribute | Indicates that the method should be exposed as a function in NAnt build files. |
Parameters
Name | Type | Description |
---|---|---|
source | string | The string to search. |
value | string | The string to locate within source. |
Return Value
Type | Description |
---|---|
int |
The highest-index position of value in source if it is found, or -1 if source does not contain value. If value is an empty string, the return value is the last index position in source. |