C# String LastIndexOf(Char)
Description
String LastIndexOf(Char)
reports the zero-based index
position of the last occurrence of a specified Unicode character within
this instance.
Syntax
String.LastIndexOf(Char)
has the following syntax.
public int LastIndexOf(
char value
)
Parameters
String.LastIndexOf(Char)
has the following parameters.
value
- The Unicode character to seek.
Returns
String.LastIndexOf(Char)
method returns The zero-based index position of value if that character is found, or -1 if
it is not.
Example
The following example uses the LastIndexOf(Char) method.
/*from w ww .ja va 2s . c o m*/
using System;
using System.IO;
public class TestLastIndexOf
{
public static void Main()
{
Console.WriteLine(@"C:\temp\".LastIndexOf('\\'));
}
}
The code above generates the following result.