Skip to content

Commit

Permalink
Don't use trick for collapsed epilogs
Browse files Browse the repository at this point in the history
  • Loading branch information
gfoidl authored and github-actions committed Aug 17, 2022
1 parent b4dcd15 commit 424f16b
Showing 1 changed file with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -986,11 +986,13 @@ private string ReplaceCore(string oldValue, string? newValue, CompareInfo? ci, C
//
public string Replace(char oldChar, char newChar)
{
int firstIndex;
if (oldChar == newChar || (firstIndex = IndexOf(oldChar)) < 0)
{
if (oldChar == newChar)
return this;

int firstIndex = IndexOf(oldChar);

if (firstIndex < 0)
return this;
}

int remainingLength = Length - firstIndex;
string result = FastAllocateString(Length);
Expand Down

0 comments on commit 424f16b

Please sign in to comment.