ReadOnlySpanSlicing.SliceBeforeOrSelf Method

Namespace
Kampute.DocToolkit.Support
Assembly
  • Kampute.DocToolkit.dll

Definition

Gets a slice of the span before the first occurrence of the specified separator.
public static ReadOnlySpan<T> SliceBeforeOrSelf<T>(this ReadOnlySpan<T> span, T separator)
	where T : IEquatable<T>

Type Parameters

T
The type of the elements in the span.

Parameters

span ReadOnlySpan<T>
The read-only span to slice.
separator T
The separator to find in the span.

Returns

ReadOnlySpan<T>
A read-only span that ends before the first occurrence of the separator, or the original span if the separator is not found.