根据ILSpy在内部显示的内容string.Split
,答案是肯定的.
private string[] InternalSplitKeepEmptyEntries(
int[] sepList, int[] lengthList, int numReplaces, int count)
{
int num = 0;
int num2 = 0;
count--;
int num3 = (numReplaces < count) ? numReplaces : count;
string[] array = new string[num3 + 1];
int num4 = 0;
while (num4 < num3 && num < this.Length)
{
array[num2++] = this.Substring(num, sepList[num4] - num);
num = sepList[num4] + ((lengthList == null) ? 1 : lengthList[num4]);
num4++;
}
if (num < this.Length && num3 >= 0)
{
array[num2] = this.Substring(num);
}
else
{
if (num2 == num3)
{
array[num2] = string.Empty;
}
}
return array;
}
Run Code Online (Sandbox Code Playgroud)
所有元素(例如array
变量)总是按升序处理,不进行排序.
在为MSDN文档string.Split
还列出了必须在相同的顺序为它们在原始字符串命令结果的例子.
正如Jim Mischel上面指出的那样,这只是当前的实施,可能会改变.
归档时间: |
|
查看次数: |
2723 次 |
最近记录: |