Sample for String.Compare(String, Int32, String, Int32, Int32, Boolean), Honor case
using System;
class Sample {
public static void Main() {
String str1 = "this is a test";
String str2 = "This is a test";
String str;
int result;
Console.WriteLine("Honor case:");
result = String.Compare(str1, 2, str2, 2, 2, false);
str = ((result < 0) ? "less than" : ((result > 0) ? "greater than" : "equal to"));
Console.Write("Substring '{0}' in '{1}' is ", str1.Substring(2, 2), str1);
Console.Write("{0} ", str);
Console.WriteLine("substring '{0}' in '{1}'.", str2.Substring(2, 2), str2);
}
}
Related examples in the same category