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

Enable char.Is{High}Surrogate(string, int) to be trimmed in default Blazor wasm app (#48621)

And simpler/faster code.
上级 28e4531a
......@@ -25,13 +25,13 @@ public DecoderReplacementFallback(string replacement)
// Make sure it doesn't have bad surrogate pairs
bool bFoundHigh = false;
for (int i = 0; i < replacement.Length; i++)
foreach (char c in replacement)
{
// Found a surrogate?
if (char.IsSurrogate(replacement, i))
if (char.IsSurrogate(c))
{
// High or Low?
if (char.IsHighSurrogate(replacement, i))
if (char.IsHighSurrogate(c))
{
// if already had a high one, stop
if (bFoundHigh)
......
......@@ -26,13 +26,13 @@ public EncoderReplacementFallback(string replacement)
// Make sure it doesn't have bad surrogate pairs
bool bFoundHigh = false;
for (int i = 0; i < replacement.Length; i++)
foreach (char c in replacement)
{
// Found a surrogate?
if (char.IsSurrogate(replacement, i))
if (char.IsSurrogate(c))
{
// High or Low?
if (char.IsHighSurrogate(replacement, i))
if (char.IsHighSurrogate(c))
{
// if already had a high one, stop
if (bFoundHigh)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册