日期:2014-05-17  浏览次数:20892 次

IndexOf和LastIndexOf问题
非空的字符串str,str.IndexOf(str)是否始终会等于0呢?
IndexOf

------解决方案--------------------
是的。LastIndexOf就不一定了。
------解决方案--------------------
编码的问题。设定参数,结果就是0了
int iIndex = "?a\r".IndexOf("?a\r",StringComparison.OrdinalIgnoreCase);