Skip to content
This repository was archived by the owner on Jan 23, 2023. It is now read-only.

Commit 9085013

Browse files
authored
Avoid two unnecessary string.Substring calls in PunycodeDecode (#18546)
1 parent 4c51b2d commit 9085013

File tree

1 file changed

+2
-2
lines changed
  • src/System.Private.CoreLib/shared/System/Globalization

1 file changed

+2
-2
lines changed

src/System.Private.CoreLib/shared/System/Globalization/IdnMapping.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -638,10 +638,10 @@ private static string PunycodeDecode(string ascii)
638638

639639
// See if this section's ASCII or ACE
640640
if (ascii.Length < c_strAcePrefix.Length + iAfterLastDot ||
641-
!ascii.Substring(iAfterLastDot,c_strAcePrefix.Length).Equals(c_strAcePrefix, StringComparison.OrdinalIgnoreCase))
641+
string.Compare(ascii, iAfterLastDot, c_strAcePrefix, 0, c_strAcePrefix.Length, StringComparison.OrdinalIgnoreCase) != 0)
642642
{
643643
// Its ASCII, copy it
644-
output.Append(ascii.Substring(iAfterLastDot, iNextDot - iAfterLastDot));
644+
output.Append(ascii, iAfterLastDot, iNextDot - iAfterLastDot);
645645
}
646646
else
647647
{

0 commit comments

Comments
 (0)