Method BeforeLast
BeforeLast(String, String)
Returns the portion of value that occurs before the last instance of searchValue.
Declaration
public static string BeforeLast(this string value, string searchValue)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | value | The value to search in. |
| System.String | searchValue | The value to search for. |
Returns
| Type | Description |
|---|---|
| System.String | Either null, or a new string containing the portion of the string before the last occurrence of |
Remarks
Returns null if searchValue is null, empty string or if searchValue does not occur within value.
Matching of searchValue is done using a System.StringComparison.Ordinal comparison.
BeforeLast(String, String, StringComparison)
Returns the portion of value that occurs before the last instance of searchValue.
Declaration
public static string BeforeLast(this string value, string searchValue, StringComparison comparisonMethod)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | value | The value to search in. |
| System.String | searchValue | The value to search for. |
| System.StringComparison | comparisonMethod | A value from the System.StringComparison enum specfying how |
Returns
| Type | Description |
|---|---|
| System.String | Either null, or a new string containing the portion of the string before the last occurrence of |
Remarks
Returns null if searchValue is null, empty string or if searchValue does not occur within value.
Matching of searchValue is done using a System.StringComparison.Ordinal comparison.