出於好奇,只是一個簡短的問題。C#字符串以空字符串結尾嗎?
string str = "string";
Console.WriteLine(str.EndsWith(string.Empty)); //true
Console.WriteLine(str.LastIndexOf(string.Empty) == str.Length); //false
//of course string are indexed from 0,
//just wrote if for fun to check whether empty string get some extra index
///somehow by a miracle:)
//finally
Console.WriteLine(str.LastIndexOf(string.Empty)
== str.LastIndexOf('g')); //true :)
什麼是你的'string.Empty`的概念?它是什麼? – thecoop 2011-01-10 13:58:18
一切都不包含任何內容。什麼都無處不在。 – BoltClock 2011-01-10 14:24:22