string letters = "abcdefghijklmabcdefghijklm";
string output = "";
// test LastIndexOf to find a character in a string
output += "\n\nLast 'c' is located at " + "index " + letters.LastIndexOf( 'c' );
output += "\nLast 'a' is located at index " + letters.LastIndexOf( 'a', 25 );
output += "\nLast '$' is located at index " + letters.LastIndexOf( '$', 15, 5 );
// test LastIndexOf to find a substring in a string
output += "\n\nLast \"def\" is located at index " + letters.LastIndexOf( "def" );
output += "\nLast \"def\" is located at " + letters.LastIndexOf( "def", 25 );
output += "\nLast \"hello\" is located at index " + letters.LastIndexOf( "hello", 20, 15 );
System.Console.WriteLine(output);
