Edit

Share via


MemoryExtensions.StartsWith Method

Definition

Overloads

StartsWith(ReadOnlySpan<Char>, ReadOnlySpan<Char>, StringComparison)

Determines whether a read-only character span begins with a specified value when compared using a specified StringComparison value.

StartsWith<T>(Span<T>, ReadOnlySpan<T>)

Determines whether a specified sequence appears at the start of a span.

StartsWith<T>(ReadOnlySpan<T>, ReadOnlySpan<T>)

Determines whether a specified sequence appears at the start of a read-only span.

StartsWith<T>(ReadOnlySpan<T>, T)

Determines whether the specified value appears at the start of the span.

StartsWith(ReadOnlySpan<Char>, ReadOnlySpan<Char>, StringComparison)

Source:
MemoryExtensions.Globalization.cs
Source:
MemoryExtensions.Globalization.cs
Source:
MemoryExtensions.Globalization.cs

Determines whether a read-only character span begins with a specified value when compared using a specified StringComparison value.

public:
[System::Runtime::CompilerServices::Extension]
 static bool StartsWith(ReadOnlySpan<char> span, ReadOnlySpan<char> value, StringComparison comparisonType);
public static bool StartsWith (this ReadOnlySpan<char> span, ReadOnlySpan<char> value, StringComparison comparisonType);
static member StartsWith : ReadOnlySpan<char> * ReadOnlySpan<char> * StringComparison -> bool
<Extension()>
Public Function StartsWith (span As ReadOnlySpan(Of Char), value As ReadOnlySpan(Of Char), comparisonType As StringComparison) As Boolean

Parameters

span
ReadOnlySpan<Char>

The source span.

value
ReadOnlySpan<Char>

The sequence to compare to the beginning of the source span.

comparisonType
StringComparison

An enumeration value that determines how span and value are compared.

Returns

true if value matches the beginning of span; otherwise, false.

Applies to

StartsWith<T>(Span<T>, ReadOnlySpan<T>)

Source:
MemoryExtensions.cs
Source:
MemoryExtensions.cs
Source:
MemoryExtensions.cs

Determines whether a specified sequence appears at the start of a span.

public:
generic <typename T>
 where T : IEquatable<T>[System::Runtime::CompilerServices::Extension]
 static bool StartsWith(Span<T> span, ReadOnlySpan<T> value);
public static bool StartsWith<T> (this Span<T> span, ReadOnlySpan<T> value) where T : IEquatable<T>;
static member StartsWith : Span<'T (requires 'T :> IEquatable<'T>)> * ReadOnlySpan<'T (requires 'T :> IEquatable<'T>)> -> bool (requires 'T :> IEquatable<'T>)
<Extension()>
Public Function StartsWith(Of T As IEquatable(Of T)) (span As Span(Of T), value As ReadOnlySpan(Of T)) As Boolean

Type Parameters

T

The type of the elements in the span.

Parameters

span
Span<T>

The span to search.

value
ReadOnlySpan<T>

A sequence to search for at the start of span.

Returns

true if value matches the beginning of span; otherwise, false.

Applies to

StartsWith<T>(ReadOnlySpan<T>, ReadOnlySpan<T>)

Source:
MemoryExtensions.cs
Source:
MemoryExtensions.cs
Source:
MemoryExtensions.cs

Determines whether a specified sequence appears at the start of a read-only span.

public:
generic <typename T>
 where T : IEquatable<T>[System::Runtime::CompilerServices::Extension]
 static bool StartsWith(ReadOnlySpan<T> span, ReadOnlySpan<T> value);
public static bool StartsWith<T> (this ReadOnlySpan<T> span, ReadOnlySpan<T> value) where T : IEquatable<T>;
static member StartsWith : ReadOnlySpan<'T (requires 'T :> IEquatable<'T>)> * ReadOnlySpan<'T (requires 'T :> IEquatable<'T>)> -> bool (requires 'T :> IEquatable<'T>)
<Extension()>
Public Function StartsWith(Of T As IEquatable(Of T)) (span As ReadOnlySpan(Of T), value As ReadOnlySpan(Of T)) As Boolean

Type Parameters

T

The type of elements in the span.

Parameters

span
ReadOnlySpan<T>

The read-only character span to search.

value
ReadOnlySpan<T>

A sequence to search for at the start of span.

Returns

true if value matches the beginning of span; otherwise, false.

Applies to

StartsWith<T>(ReadOnlySpan<T>, T)

Determines whether the specified value appears at the start of the span.

public:
generic <typename T>
 where T : IEquatable<T>[System::Runtime::CompilerServices::Extension]
 static bool StartsWith(ReadOnlySpan<T> span, T value);
public static bool StartsWith<T> (this ReadOnlySpan<T> span, T value) where T : IEquatable<T>;
static member StartsWith : ReadOnlySpan<'T (requires 'T :> IEquatable<'T>)> * 'T -> bool (requires 'T :> IEquatable<'T>)
<Extension()>
Public Function StartsWith(Of T As IEquatable(Of T)) (span As ReadOnlySpan(Of T), value As T) As Boolean

Type Parameters

T

The type of elements in the span.

Parameters

span
ReadOnlySpan<T>

The span to search.

value
T

The value to compare.

Returns

true if value matches the beginning of span; otherwise, false.

Applies to