Table of Contents

Method CreateReadOnlyExSpanFromNullTerminated

Namespace
Zyl.ExSpans
Assembly
ExSpans.Core.dll

CreateReadOnlyExSpanFromNullTerminated(char*)

Creates a new read-only span for a null-terminated string (为 空终止字符串 创建新的只读跨度).

[CLSCompliant(false)]
public static ReadOnlyExSpan<char> CreateReadOnlyExSpanFromNullTerminated(char* value)

Parameters

value char*

The pointer to the null-terminated string of characters (指向空终止字符串的字符指针).

Returns

ReadOnlyExSpan<char>

A read-only span representing the specified null-terminated string, or an empty span if the pointer is null (表示指定空终结字符串的只读跨度, 如果指针为null, 则为空跨度).

Remarks

The returned span does not include the null terminator (返回的跨度不包括空终止符).

Exceptions

ArgumentException

The string is longer than MaxValue.

CreateReadOnlyExSpanFromNullTerminated(byte*)

Creates a new read-only span for a null-terminated UTF-8 string (为 空终止UTF-8字符串 创建新的只读跨度).

[CLSCompliant(false)]
public static ReadOnlyExSpan<byte> CreateReadOnlyExSpanFromNullTerminated(byte* value)

Parameters

value byte*

The pointer to the null-terminated string of bytes (指向空终止字符串的字节指针).

Returns

ReadOnlyExSpan<byte>

A read-only span representing the specified null-terminated string, or an empty span if the pointer is null (表示指定空终结字符串的只读跨度, 如果指针为null, 则为空跨度).

Remarks

The returned span does not include the null terminator, nor does it validate the well-formedness of the UTF-8 data (返回的跨度不包括空终止符, 也不验证UTF-8数据的格式正确性).

Exceptions

ArgumentException

The string is longer than MaxValue.