Skip to content

Commit 403bbb3

Browse files
committed
split Polyfill_StringBuilder_Replace
1 parent 7e07c8a commit 403bbb3

File tree

2 files changed

+34
-24
lines changed

2 files changed

+34
-24
lines changed

src/Polyfill/Polyfill_StringBuilder.cs

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -38,28 +38,4 @@ public static bool Equals(this StringBuilder target, ReadOnlySpan<char> span)
3838
}
3939

4040
#endif
41-
42-
#if !NET9_0_OR_GREATER && FeatureMemory
43-
/// <summary>
44-
/// Replaces all instances of one string with another in part of this builder.
45-
/// </summary>
46-
/// <param name="oldValue">The string to replace.</param>
47-
/// <param name="newValue">The string to replace <paramref name="oldValue"/> with.</param>
48-
/// <param name="startIndex">The index to start in this builder.</param>
49-
/// <param name="count">The number of characters to read in this builder.</param>
50-
//Link: https://learn.microsoft.com/en-us/dotnet/api/system.text.stringbuilder.replace#system-text-stringbuilder-replace(system-readonlyspan((system-char))-system-readonlyspan((system-char)))
51-
public static StringBuilder Replace(this StringBuilder target, ReadOnlySpan<char> oldValue, ReadOnlySpan<char> newValue) =>
52-
target.Replace(oldValue.ToString(), newValue.ToString());
53-
54-
/// <summary>
55-
/// Replaces all instances of one read-only character span with another in part of this builder.
56-
/// </summary>
57-
/// <param name="oldValue">The read-only character span to replace.</param>
58-
/// <param name="newValue">The read-only character span to replace <paramref name="oldValue"/> with.</param>
59-
/// <param name="startIndex">The index to start in this builder.</param>
60-
/// <param name="count">The number of characters to read in this builder.</param>
61-
//Link: https://learn.microsoft.com/en-us/dotnet/api/system.text.stringbuilder.replace#system-text-stringbuilder-replace(system-char-system-char-system-int32-system-int32)
62-
public static StringBuilder Replace(this StringBuilder target, ReadOnlySpan<char> oldValue, ReadOnlySpan<char> newValue, int startIndex, int count) =>
63-
target.Replace(oldValue.ToString(), newValue.ToString(), startIndex, count);
64-
#endif
6541
}
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
// <auto-generated />
2+
#pragma warning disable
3+
4+
namespace Polyfills;
5+
6+
using System;
7+
using System.Text;
8+
9+
static partial class Polyfill
10+
{
11+
#if !NET9_0_OR_GREATER && FeatureMemory
12+
/// <summary>
13+
/// Replaces all instances of one string with another in part of this builder.
14+
/// </summary>
15+
/// <param name="oldValue">The string to replace.</param>
16+
/// <param name="newValue">The string to replace <paramref name="oldValue"/> with.</param>
17+
/// <param name="startIndex">The index to start in this builder.</param>
18+
/// <param name="count">The number of characters to read in this builder.</param>
19+
//Link: https://learn.microsoft.com/en-us/dotnet/api/system.text.stringbuilder.replace#system-text-stringbuilder-replace(system-readonlyspan((system-char))-system-readonlyspan((system-char)))
20+
public static StringBuilder Replace(this StringBuilder target, ReadOnlySpan<char> oldValue, ReadOnlySpan<char> newValue) =>
21+
target.Replace(oldValue.ToString(), newValue.ToString());
22+
23+
/// <summary>
24+
/// Replaces all instances of one read-only character span with another in part of this builder.
25+
/// </summary>
26+
/// <param name="oldValue">The read-only character span to replace.</param>
27+
/// <param name="newValue">The read-only character span to replace <paramref name="oldValue"/> with.</param>
28+
/// <param name="startIndex">The index to start in this builder.</param>
29+
/// <param name="count">The number of characters to read in this builder.</param>
30+
//Link: https://learn.microsoft.com/en-us/dotnet/api/system.text.stringbuilder.replace#system-text-stringbuilder-replace(system-char-system-char-system-int32-system-int32)
31+
public static StringBuilder Replace(this StringBuilder target, ReadOnlySpan<char> oldValue, ReadOnlySpan<char> newValue, int startIndex, int count) =>
32+
target.Replace(oldValue.ToString(), newValue.ToString(), startIndex, count);
33+
#endif
34+
}

0 commit comments

Comments
 (0)