未验证 提交 a5d94535 编写于 作者: S Stephen Toub 提交者: GitHub

Use IndexOf in Uri.GetLocalPath (#75323)

上级 c2790d52
......@@ -1034,12 +1034,12 @@ private string GetLocalPath()
// We don't know whether all slashes were the back ones
// Plus going through Compress will turn them into / anyway
// Converting / back into \
for (ushort i = 0; i < (ushort)count; ++i)
Span<char> slashSpan = result.AsSpan(0, count);
int slashPos;
while ((slashPos = slashSpan.IndexOf('/')) >= 0)
{
if (result[i] == '/')
{
result[i] = '\\';
}
slashSpan[slashPos] = '\\';
slashSpan = slashSpan.Slice(slashPos + 1);
}
return new string(result, 0, count);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册