有下面代码:
using System;public class CompareToTest {
public static void Main() { string s1 ="a";
string s2 ="A"; // compare a string to itself
int cmpVal = s1.CompareTo(s2);
if (cmpVal > 0)
Console.WriteLine("S1>S2");
else if (cmpVal == 0 )
Console.WriteLine("S1=S2");
else
Console.WriteLine("S1<S2");
Console.ReadLine();
}}
结过是S1<S2,难道a 是97,A是65结过应该是S1>S2把?
using System;public class CompareToTest {
public static void Main() { string s1 ="a";
string s2 ="A"; // compare a string to itself
int cmpVal = s1.CompareTo(s2);
if (cmpVal > 0)
Console.WriteLine("S1>S2");
else if (cmpVal == 0 )
Console.WriteLine("S1=S2");
else
Console.WriteLine("S1<S2");
Console.ReadLine();
}}
结过是S1<S2,难道a 是97,A是65结过应该是S1>S2把?
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货