SpanHelpers
namespace System
{
internal static class SpanHelpers
{
public static void CopyAndTerminate(this ReadOnlySpan<char> source, Span<char> destination)
{
if (source.Length >= destination.Length)
source = source.Slice(0, destination.Length - 1);
source.CopyTo(destination);
destination[source.Length] = ' ';
}
public static ReadOnlySpan<char> SliceAtFirstNull(this ReadOnlySpan<char> span)
{
int num = span.IndexOf(' ');
if (num != -1)
return span.Slice(0, num);
return span;
}
public static Span<char> SliceAtFirstNull(this Span<char> span)
{
int num = span.IndexOf(' ');
if (num != -1)
return span.Slice(0, num);
return span;
}
}
}