SpanExtensionsReadToSeparator(ReadOnlySpanChar, Char) Method

Advances the specified rest parameter after the next separator character and returns the consumed part without the separator. If the first character of rest was a separator before the call, then an empty span is returned. If the whole ReadOnlySpan<char> has been processed, then rest will be ReadOnlySpan<char>.Empty after returning.

Definition

Namespace: KGySoft.CoreLibraries
Assembly: KGySoft.CoreLibraries (in KGySoft.CoreLibraries.dll) Version: 8.1.0
C#
public static ReadOnlySpan<char> ReadToSeparator(
	this ref ReadOnlySpan<char> rest,
	char separator
)

Parameters

rest  ReadOnlySpanChar
Represents the rest of the string to process. When this method returns, the value of this parameter will be the remaining unprocessed part, or ReadOnlySpan<char>.Empty if the whole span has been processed.
separator  Char
The separator character to search in the specified span.

Return Value

ReadOnlySpanChar
A ReadOnlySpan<char> that contains the first segment of the original value of the rest parameter delimited by the specified separator, or the complete original value of rest if it contained no more separators.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type ReadOnlySpanChar. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).

See Also