Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 1 addition & 7 deletions src/LinkDotNet.StringBuilder/ValueStringBuilder.Replace.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,7 @@ public readonly void Replace(char oldValue, char newValue, int startIndex, int c
ArgumentOutOfRangeException.ThrowIfLessThan(startIndex, 0);
ArgumentOutOfRangeException.ThrowIfGreaterThan(startIndex + count, Length);

for (var i = startIndex; i < startIndex + count; i++)
{
if (buffer[i] == oldValue)
{
buffer[i] = newValue;
}
}
buffer.Slice(startIndex, count).Replace(oldValue, newValue);
}

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public static ValueStringBuilder ToValueStringBuilder(this System.Text.StringBui
{
ArgumentNullException.ThrowIfNull(builder);

var valueStringBuilder = new ValueStringBuilder();
var valueStringBuilder = new ValueStringBuilder(builder.Length);
foreach (var chunk in builder.GetChunks())
{
valueStringBuilder.Append(chunk.Span);
Expand Down