MemoryExtensionsStripPrefix(ReadOnlySpanChar, ReadOnlySpanChar, StringComparison) Method

Removes a prefix from a span of characters.

Definition

Namespace: Ookii.Common
Assembly: Ookii.Common (in Ookii.Common.dll) Version: 1.0.0+7c2900b8a16cd8ae46bdd79d8f105034712c5fa3
C#
public static NullableReadOnlySpan<char> StripPrefix(
	this ReadOnlySpan<char> span,
	ReadOnlySpan<char> prefix,
	StringComparison comparisonType
)

Parameters

span  ReadOnlySpanChar
The span of characters to remove the prefix from.
prefix  ReadOnlySpanChar
The prefix to remove.
comparisonType  StringComparison
The type of string comparison to use to match the prefix.

Return Value

NullableReadOnlySpanChar
If span starts with prefix, returns the span without the prefix; otherwise, returns an empty NullableReadOnlySpanT.

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