Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 1 addition & 1 deletion apiCount.include.md
Original file line number Diff line number Diff line change
@@ -1 +1 @@
**API count: 437**
**API count: 441**
4 changes: 4 additions & 0 deletions api_list.include.md
Original file line number Diff line number Diff line change
Expand Up @@ -577,8 +577,12 @@
#### StringPolyfill

* `string Join(char, object[])` [reference](https://learn.microsoft.com/en-us/dotnet/api/system.string.join#system-string-join(system-char-system-object()))
* `string Join(char, ReadOnlySpan<object?>)` [reference](https://learn.microsoft.com/en-us/dotnet/api/system.string.join#system-string-join(system-char-system-readonlyspan((system-object))))
* `string Join(char, ReadOnlySpan<string?>)` [reference](https://learn.microsoft.com/en-us/dotnet/api/system.string.join#system-string-join(system-char-system-readonlyspan((system-string))))
* `string Join(char, string?[], int, int)` [reference](https://learn.microsoft.com/en-us/dotnet/api/system.string.join#system-string-join(system-char-system-string()-system-int32-system-int32))
* `string Join(char, string[])` [reference](https://learn.microsoft.com/en-us/dotnet/api/system.string.join#system-string-join(system-char-system-string()))
* `string Join(string, ReadOnlySpan<object?>)` [reference](https://learn.microsoft.com/en-us/dotnet/api/system.string.join#system-string-join(system-string-system-readonlyspan((system-object))))
* `string Join(string, ReadOnlySpan<string?>)` [reference](https://learn.microsoft.com/en-us/dotnet/api/system.string.join#system-string-join(system-string-system-readonlyspan((system-string))))
* `string Join<T>(char, IEnumerable<T>)` [reference](https://learn.microsoft.com/en-us/dotnet/api/system.string.join#system-string-join-1(system-char-system-collections-generic-ienumerable((-0))))


Expand Down
6 changes: 5 additions & 1 deletion readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ The package targets `netstandard2.0` and is designed to support the following ru
* `net5.0`, `net6.0`, `net7.0`, `net8.0`, `net9.0`


**API count: 437**<!-- singleLineInclude: apiCount. path: /apiCount.include.md -->
**API count: 441**<!-- singleLineInclude: apiCount. path: /apiCount.include.md -->


**See [Milestones](../../milestones?state=closed) for release notes.**
Expand Down Expand Up @@ -1046,8 +1046,12 @@ The class `Polyfill` includes the following extension methods:
#### StringPolyfill

* `string Join(char, object[])` [reference](https://learn.microsoft.com/en-us/dotnet/api/system.string.join#system-string-join(system-char-system-object()))
* `string Join(char, ReadOnlySpan<object?>)` [reference](https://learn.microsoft.com/en-us/dotnet/api/system.string.join#system-string-join(system-char-system-readonlyspan((system-object))))
* `string Join(char, ReadOnlySpan<string?>)` [reference](https://learn.microsoft.com/en-us/dotnet/api/system.string.join#system-string-join(system-char-system-readonlyspan((system-string))))
* `string Join(char, string?[], int, int)` [reference](https://learn.microsoft.com/en-us/dotnet/api/system.string.join#system-string-join(system-char-system-string()-system-int32-system-int32))
* `string Join(char, string[])` [reference](https://learn.microsoft.com/en-us/dotnet/api/system.string.join#system-string-join(system-char-system-string()))
* `string Join(string, ReadOnlySpan<object?>)` [reference](https://learn.microsoft.com/en-us/dotnet/api/system.string.join#system-string-join(system-string-system-readonlyspan((system-object))))
* `string Join(string, ReadOnlySpan<string?>)` [reference](https://learn.microsoft.com/en-us/dotnet/api/system.string.join#system-string-join(system-string-system-readonlyspan((system-string))))
* `string Join<T>(char, IEnumerable<T>)` [reference](https://learn.microsoft.com/en-us/dotnet/api/system.string.join#system-string-join-1(system-char-system-collections-generic-ienumerable((-0))))


Expand Down
51 changes: 49 additions & 2 deletions src/Polyfill/StringPolyfill.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

namespace Polyfills;

using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
Expand All @@ -18,7 +19,7 @@ static partial class StringPolyfill
/// Concatenates an array of strings, using the specified separator between each member.
/// </summary>
//Link: https://learn.microsoft.com/en-us/dotnet/api/system.string.join#system-string-join(system-char-system-string())
public static string Join(char separator, string[] values) =>
public static string Join(char separator, params string[] values) =>
#if NETSTANDARD2_0 || NETFRAMEWORK
string.Join(new([separator]), values);
#else
Expand All @@ -29,13 +30,59 @@ public static string Join(char separator, string[] values) =>
/// Concatenates the string representations of an array of objects, using the specified separator between each member.
/// </summary>
//Link: https://learn.microsoft.com/en-us/dotnet/api/system.string.join#system-string-join(system-char-system-object())
public static string Join(char separator, object[] values) =>
public static string Join(char separator, params object[] values) =>
#if NETSTANDARD2_0 || NETFRAMEWORK
string.Join(new([separator]), values);
#else
string.Join(separator, values);
#endif

#if FeatureMemory
/// <summary>
/// Concatenates the string representations of a span of objects, using the specified separator between each member.
/// </summary>
//Link: https://learn.microsoft.com/en-us/dotnet/api/system.string.join#system-string-join(system-char-system-readonlyspan((system-object)))
public static string Join(char separator, scoped ReadOnlySpan<object?> values) =>
#if NET9_0_OR_GREATER
string.Join(separator, values);
#else
Join(separator, values.ToArray());
#endif

/// <summary>
/// Concatenates a span of strings, using the specified separator between each member.
/// </summary>
//Link: https://learn.microsoft.com/en-us/dotnet/api/system.string.join#system-string-join(system-char-system-readonlyspan((system-string)))
public static string Join(char separator, scoped ReadOnlySpan<string?> values) =>
#if NET9_0_OR_GREATER
string.Join(separator, values);
#else
Join(separator, values.ToArray());
#endif

/// <summary>
/// Concatenates the string representations of a span of objects, using the specified separator between each member.
/// </summary>
//Link: https://learn.microsoft.com/en-us/dotnet/api/system.string.join#system-string-join(system-string-system-readonlyspan((system-object)))
public static string Join(string separator, scoped ReadOnlySpan<object?> values) =>
#if NET9_0_OR_GREATER
string.Join(separator, values);
#else
string.Join(separator, values.ToArray());
#endif

/// <summary>
/// Concatenates a span of strings, using the specified separator between each member.
/// </summary>
//Link: https://learn.microsoft.com/en-us/dotnet/api/system.string.join#system-string-join(system-string-system-readonlyspan((system-string)))
public static string Join(string separator, scoped ReadOnlySpan<string?> values) =>
#if NET9_0_OR_GREATER
string.Join(separator, values);
#else
string.Join(separator, values.ToArray());
#endif
#endif

/// <summary>
/// Concatenates the specified elements of a string array, using the specified separator between each element.
/// </summary>
Expand Down