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 committed Jul 20, 2022
1 parent 4e99ac4 commit 30889ac
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 30889ac

Please sign in to comment.