我不明白为什么EndsWith返回false。
我有C#代码:
string heading = "yakobusho";
bool test = (heading == "yakobusho");
bool back = heading.EndsWith("sho");
bool front = heading.StartsWith("yak");
bool other = "yakobusho".EndsWith("sho");
Debug.WriteLine("heading = " + heading);
Debug.WriteLine("test = " + test.ToString());
Debug.WriteLine("back = " + back.ToString());
Debug.WriteLine("front = " + front.ToString());
Debug.WriteLine("other = " + other.ToString());输出为:
heading = yakobusho
test = True
back = False
front = True
other = TrueEndsWith是怎么回事?
发布于 2019-03-07 22:35:55
这在"sho“字符串之前包含一个不可见的字符:
bool back = heading.EndsWith("sho");更正后的行:
bool back = heading.EndsWith("sho");https://stackoverflow.com/questions/55046203
复制相似问题