Upload from upload_mods.ps1

This commit is contained in:
Nathaniel Cosford
2025-06-04 16:13:32 +09:30
commit 7345f42201
470 changed files with 51966 additions and 0 deletions

View File

@@ -0,0 +1,32 @@
using System;
using System.Collections.Generic;
using UniLinq;
namespace Sprache
{
internal static class StringExtensions
{
public static IEnumerable<char> ToEnumerable(this string @this)
{
#if STRING_IS_ENUMERABLE
return @this;
#else
if (@this == null) throw new ArgumentNullException(nameof(@this));
for (var i = 0; i < @this.Length; ++i)
{
yield return @this[i];
}
#endif
}
public static string Join<T>(string separator, IEnumerable<T> values)
{
#if STRING_JOIN_ENUMERABLE
return string.Join(separator, values);
#else
return string.Join(separator, values.Select(v => v.ToString()).ToArray());
#endif
}
}
}