Skip to content

Commit 6b9b435

Browse files
authored
Add StringBuilder Insert (#282)
1 parent 403bbb3 commit 6b9b435

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
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 (!NETCOREAPP2_1_OR_GREATER || NETSTANDARD2_0) && FeatureMemory
12+
/// <summary>
13+
/// Inserts the sequence of characters into this instance at the specified character position.
14+
/// </summary>
15+
/// <param name="index">The position in this instance where insertion begins.</param>
16+
/// <param name="value">The character span to insert.</param>
17+
/// <returns>A reference to this instance after the insert operation has completed.</returns>
18+
//Link: https://learn.microsoft.com/en-us/dotnet/api/system.text.stringbuilder.insert#system-text-stringbuilder-insert(system-int32-system-readonlyspan((system-char)))
19+
public static StringBuilder Insert(this StringBuilder target, int index, ReadOnlySpan<char> value) =>
20+
target.Insert(index, value.ToString());
21+
#endif
22+
}

0 commit comments

Comments
 (0)