Utf8Parser.TryParse 方法

定义

重载

名称 说明
TryParse(ReadOnlySpan<Byte>, Boolean, Int32, Char)

分析 Utf8 字符串开头的 A Boolean

TryParse(ReadOnlySpan<Byte>, Byte, Int32, Char)

分析 Utf8 字符串开头的 A Byte

TryParse(ReadOnlySpan<Byte>, DateTime, Int32, Char)

分析 Utf8 字符串开头的 A DateTime

TryParse(ReadOnlySpan<Byte>, DateTimeOffset, Int32, Char)

分析 Utf8 字符串开头的 A DateTimeOffset

TryParse(ReadOnlySpan<Byte>, Decimal, Int32, Char)

分析 Utf8 字符串开头的 A Decimal

TryParse(ReadOnlySpan<Byte>, Double, Int32, Char)

分析 Utf8 字符串开头的 A Double

TryParse(ReadOnlySpan<Byte>, Guid, Int32, Char)

分析 Utf8 字符串开头的 A Guid

TryParse(ReadOnlySpan<Byte>, Int16, Int32, Char)

分析 Utf8 字符串开头的一个 Int16 值。

TryParse(ReadOnlySpan<Byte>, Int32, Int32, Char)

分析 Utf8 字符串开头的一个 Int32 值。

TryParse(ReadOnlySpan<Byte>, Int64, Int32, Char)

分析 Utf8 字符串开头的一个 Int64 值。

TryParse(ReadOnlySpan<Byte>, SByte, Int32, Char)

分析 Utf8 字符串开头的一个 SByte 值。

TryParse(ReadOnlySpan<Byte>, Single, Int32, Char)

分析 Utf8 字符串开头的 A Single

TryParse(ReadOnlySpan<Byte>, TimeSpan, Int32, Char)

分析 Utf8 字符串开头的 A TimeSpan

TryParse(ReadOnlySpan<Byte>, UInt16, Int32, Char)

分析 Utf8 字符串开头的 A UInt16

TryParse(ReadOnlySpan<Byte>, UInt32, Int32, Char)

分析 Utf8 字符串开头的 A UInt32

TryParse(ReadOnlySpan<Byte>, UInt64, Int32, Char)

分析 Utf8 字符串开头的 A UInt64

TryParse(ReadOnlySpan<Byte>, Boolean, Int32, Char)

Source:
Utf8Parser.Boolean.cs
Source:
Utf8Parser.Boolean.cs
Source:
Utf8Parser.Boolean.cs
Source:
Utf8Parser.Boolean.cs
Source:
Utf8Parser.Boolean.cs

分析 Utf8 字符串开头的 A Boolean

public static bool TryParse(ReadOnlySpan<byte> source, out bool value, out int bytesConsumed, char standardFormat = '\0');
static member TryParse : ReadOnlySpan<byte> * bool * int * char -> bool
Public Shared Function TryParse (source As ReadOnlySpan(Of Byte), ByRef value As Boolean, ByRef bytesConsumed As Integer, Optional standardFormat As Char = '\0') As Boolean

参数

source
ReadOnlySpan<Byte>

要分析的 Utf8 字符串。

value
Boolean

当该方法返回时,如果分析操作成功,则包含从 source中分析的值。

bytesConsumed
Int32

如果分析操作成功,则该方法返回时包含已分析子字符串的长度(以字节为单位)。 如果方法失败, bytesConsumed 则设置为 0。

standardFormat
Char

Utf8 字符串的预期格式。 支持的格式是 'G''l'以及 default

返回

true 成功; false 如果字符串在语法上无效或发生溢出或下溢,则为 。

注解

分析不区分大小写。 验证格式参数以确保它受支持;但是,所有受支持的格式都以相同的方式处理。

适用于

TryParse(ReadOnlySpan<Byte>, Byte, Int32, Char)

Source:
Utf8Parser.Integer.Unsigned.cs
Source:
Utf8Parser.Integer.Unsigned.cs
Source:
Utf8Parser.Integer.Unsigned.cs
Source:
Utf8Parser.Integer.Unsigned.cs
Source:
Utf8Parser.Integer.Unsigned.cs

分析 Utf8 字符串开头的 A Byte

public static bool TryParse(ReadOnlySpan<byte> source, out byte value, out int bytesConsumed, char standardFormat = '\0');
static member TryParse : ReadOnlySpan<byte> * byte * int * char -> bool
Public Shared Function TryParse (source As ReadOnlySpan(Of Byte), ByRef value As Byte, ByRef bytesConsumed As Integer, Optional standardFormat As Char = '\0') As Boolean

参数

source
ReadOnlySpan<Byte>

要分析的 Utf8 字符串。

value
Byte

当该方法返回时,如果分析操作成功,则包含从 source中分析的值。

bytesConsumed
Int32

如果分析操作成功,则该方法返回时包含已分析子字符串的长度(以字节为单位)。 如果方法失败, bytesConsumed 则设置为 0。

standardFormat
Char

Utf8 字符串的预期格式。

返回

true 成功; false 如果字符串在语法上无效或发生溢出或下溢,则为 。

注解

支持的格式:

格式字符串 预期格式示例
G/g (默认值)
D/d 122
N/n 122
X/x 7a

适用于

TryParse(ReadOnlySpan<Byte>, DateTime, Int32, Char)

Source:
Utf8Parser.Date.cs
Source:
Utf8Parser.Date.cs
Source:
Utf8Parser.Date.cs
Source:
Utf8Parser.Date.cs
Source:
Utf8Parser.Date.cs

分析 Utf8 字符串开头的 A DateTime

public static bool TryParse(ReadOnlySpan<byte> source, out DateTime value, out int bytesConsumed, char standardFormat = '\0');
static member TryParse : ReadOnlySpan<byte> * DateTime * int * char -> bool
Public Shared Function TryParse (source As ReadOnlySpan(Of Byte), ByRef value As DateTime, ByRef bytesConsumed As Integer, Optional standardFormat As Char = '\0') As Boolean

参数

source
ReadOnlySpan<Byte>

要分析的 Utf8 字符串。

value
DateTime

当该方法返回时,如果分析操作成功,则包含从 source中分析的值。

bytesConsumed
Int32

如果分析操作成功,则该方法返回时包含已分析子字符串的长度(以字节为单位)。 如果方法失败, bytesConsumed 则设置为 0。

standardFormat
Char

Utf8 字符串的预期格式。

返回

true 成功; false 如果字符串在语法上无效或发生溢出或下溢,则为 。

注解

支持的格式:

格式字符串 预期格式示例 注释
G (默认值) 05/25/2017 10:30:15
R 2017年1月3日星期二 08:08:05 GMT (RFC 1123)
l 周二, 2017 年 1 月 3 日 08:08:05 gmt (小写 RFC 1123)
O 2017-06-12T05:30:45.7680000-07:00 (往返)

适用于

TryParse(ReadOnlySpan<Byte>, DateTimeOffset, Int32, Char)

Source:
Utf8Parser.Date.cs
Source:
Utf8Parser.Date.cs
Source:
Utf8Parser.Date.cs
Source:
Utf8Parser.Date.cs
Source:
Utf8Parser.Date.cs

分析 Utf8 字符串开头的 A DateTimeOffset

public static bool TryParse(ReadOnlySpan<byte> source, out DateTimeOffset value, out int bytesConsumed, char standardFormat = '\0');
static member TryParse : ReadOnlySpan<byte> * DateTimeOffset * int * char -> bool
Public Shared Function TryParse (source As ReadOnlySpan(Of Byte), ByRef value As DateTimeOffset, ByRef bytesConsumed As Integer, Optional standardFormat As Char = '\0') As Boolean

参数

source
ReadOnlySpan<Byte>

要分析的 Utf8 字符串。

value
DateTimeOffset

当该方法返回时,如果分析操作成功,则包含从 source中分析的值。

bytesConsumed
Int32

如果分析操作成功,则该方法返回时包含已分析子字符串的长度(以字节为单位)。 如果方法失败, bytesConsumed 则设置为 0。

standardFormat
Char

Utf8 字符串的预期格式。

返回

true 成功; false 如果字符串在语法上无效或发生溢出或下溢,则为 。

注解

支持的格式:

格式字符串 预期格式示例 注释
G (默认值) 05/25/2017 10:30:15
R 2017年1月3日星期二 08:08:05 GMT (RFC 1123)
l 周二, 2017 年 1 月 3 日 08:08:05 gmt (小写 RFC 1123)
O 2017-06-12T05:30:45.7680000-07:00 (往返)

适用于

TryParse(ReadOnlySpan<Byte>, Decimal, Int32, Char)

Source:
Utf8Parser.Decimal.cs
Source:
Utf8Parser.Decimal.cs
Source:
Utf8Parser.Decimal.cs
Source:
Utf8Parser.Decimal.cs
Source:
Utf8Parser.Decimal.cs

分析 Utf8 字符串开头的 A Decimal

public static bool TryParse(ReadOnlySpan<byte> source, out decimal value, out int bytesConsumed, char standardFormat = '\0');
static member TryParse : ReadOnlySpan<byte> * decimal * int * char -> bool
Public Shared Function TryParse (source As ReadOnlySpan(Of Byte), ByRef value As Decimal, ByRef bytesConsumed As Integer, Optional standardFormat As Char = '\0') As Boolean

参数

source
ReadOnlySpan<Byte>

要分析的 Utf8 字符串。

value
Decimal

当该方法返回时,如果分析操作成功,则包含从 source中分析的值。

bytesConsumed
Int32

如果分析操作成功,则该方法返回时包含已分析子字符串的长度(以字节为单位)。 如果方法失败, bytesConsumed 则设置为 0。

standardFormat
Char

Utf8 字符串的预期格式。

返回

true 成功; false 如果字符串在语法上无效或发生溢出或下溢,则为 。

注解

支持的格式:

格式字符串 预期格式示例 注释
G/g (默认值)
F/f 12.45 固定点
E/e 1.245000e1 指数

适用于

TryParse(ReadOnlySpan<Byte>, Double, Int32, Char)

Source:
Utf8Parser.Float.cs
Source:
Utf8Parser.Float.cs
Source:
Utf8Parser.Float.cs
Source:
Utf8Parser.Float.cs
Source:
Utf8Parser.Float.cs

分析 Utf8 字符串开头的 A Double

public static bool TryParse(ReadOnlySpan<byte> source, out double value, out int bytesConsumed, char standardFormat = '\0');
static member TryParse : ReadOnlySpan<byte> * double * int * char -> bool
Public Shared Function TryParse (source As ReadOnlySpan(Of Byte), ByRef value As Double, ByRef bytesConsumed As Integer, Optional standardFormat As Char = '\0') As Boolean

参数

source
ReadOnlySpan<Byte>

要分析的 Utf8 字符串。

value
Double

当该方法返回时,如果分析操作成功,则包含从 source中分析的值。

bytesConsumed
Int32

如果分析操作成功,则该方法返回时包含已分析子字符串的长度(以字节为单位)。 如果方法失败, bytesConsumed 则设置为 0。

standardFormat
Char

Utf8 字符串的预期格式。

返回

true 成功; false 如果字符串在语法上无效或发生溢出或下溢,则为 。

注解

支持的格式:

格式字符串 预期格式示例 注释
G/g (默认值)
F/f 12.45 固定点
E/e 1.245000e1 指数

适用于

TryParse(ReadOnlySpan<Byte>, Guid, Int32, Char)

Source:
Utf8Parser.Guid.cs
Source:
Utf8Parser.Guid.cs
Source:
Utf8Parser.Guid.cs
Source:
Utf8Parser.Guid.cs
Source:
Utf8Parser.Guid.cs

分析 Utf8 字符串开头的 A Guid

public static bool TryParse(ReadOnlySpan<byte> source, out Guid value, out int bytesConsumed, char standardFormat = '\0');
static member TryParse : ReadOnlySpan<byte> * Guid * int * char -> bool
Public Shared Function TryParse (source As ReadOnlySpan(Of Byte), ByRef value As Guid, ByRef bytesConsumed As Integer, Optional standardFormat As Char = '\0') As Boolean

参数

source
ReadOnlySpan<Byte>

要分析的 Utf8 字符串。

value
Guid

当该方法返回时,如果分析操作成功,则包含从 source中分析的值。

bytesConsumed
Int32

如果分析操作成功,则该方法返回时包含已分析子字符串的长度(以字节为单位)。 如果方法失败, bytesConsumed 则设置为 0。

standardFormat
Char

Utf8 字符串的预期格式。

返回

true 成功; false 如果字符串在语法上无效或发生溢出或下溢,则为 。

注解

支持的格式:

格式字符串 预期格式
D (默认值) nnnnnnnn-nnnn-nnnn-nnnn-nnnnnnnn
B {nnnnnnnn-nnnn-nnnn-nnnn-nnnn}
P (nnnnnnnn-nnnn-nnnn-nnnn-nnnn)
N nnnn

适用于

TryParse(ReadOnlySpan<Byte>, Int16, Int32, Char)

Source:
Utf8Parser.Integer.Signed.cs
Source:
Utf8Parser.Integer.Signed.cs
Source:
Utf8Parser.Integer.Signed.cs
Source:
Utf8Parser.Integer.Signed.cs
Source:
Utf8Parser.Integer.Signed.cs

分析 Utf8 字符串开头的一个 Int16 值。

public static bool TryParse(ReadOnlySpan<byte> source, out short value, out int bytesConsumed, char standardFormat = '\0');
static member TryParse : ReadOnlySpan<byte> * int16 * int * char -> bool
Public Shared Function TryParse (source As ReadOnlySpan(Of Byte), ByRef value As Short, ByRef bytesConsumed As Integer, Optional standardFormat As Char = '\0') As Boolean

参数

source
ReadOnlySpan<Byte>

要分析的 Utf8 字符串。

value
Int16

当该方法返回时,如果分析操作成功,则包含从 source中分析的值。

bytesConsumed
Int32

如果分析操作成功,则该方法返回时包含已分析子字符串的长度(以字节为单位)。 如果方法失败, bytesConsumed 则设置为 0。

standardFormat
Char

Utf8 字符串的预期格式。

返回

true 成功; false 如果字符串在语法上无效或发生溢出或下溢,则为 。

注解

支持的格式:

格式字符串 预期格式示例
G/g (默认值)
D/d 32767
N/n 32,767
X/x 7fff

适用于

TryParse(ReadOnlySpan<Byte>, Int32, Int32, Char)

Source:
Utf8Parser.Integer.Signed.cs
Source:
Utf8Parser.Integer.Signed.cs
Source:
Utf8Parser.Integer.Signed.cs
Source:
Utf8Parser.Integer.Signed.cs
Source:
Utf8Parser.Integer.Signed.cs

分析 Utf8 字符串开头的一个 Int32 值。

public static bool TryParse(ReadOnlySpan<byte> source, out int value, out int bytesConsumed, char standardFormat = '\0');
static member TryParse : ReadOnlySpan<byte> * int * int * char -> bool
Public Shared Function TryParse (source As ReadOnlySpan(Of Byte), ByRef value As Integer, ByRef bytesConsumed As Integer, Optional standardFormat As Char = '\0') As Boolean

参数

source
ReadOnlySpan<Byte>

要分析的 Utf8 字符串。

value
Int32

当该方法返回时,如果分析操作成功,则包含从 source中分析的值。

bytesConsumed
Int32

如果分析操作成功,则该方法返回时包含已分析子字符串的长度(以字节为单位)。 如果方法失败, bytesConsumed 则设置为 0。

standardFormat
Char

Utf8 字符串的预期格式。

返回

true 成功; false 如果字符串在语法上无效或发生溢出或下溢,则为 。

注解

支持的格式:

格式字符串 预期格式示例
G/g (默认值)
D/d 32767
N/n 32,767
X/x 7fff

适用于

TryParse(ReadOnlySpan<Byte>, Int64, Int32, Char)

Source:
Utf8Parser.Integer.Signed.cs
Source:
Utf8Parser.Integer.Signed.cs
Source:
Utf8Parser.Integer.Signed.cs
Source:
Utf8Parser.Integer.Signed.cs
Source:
Utf8Parser.Integer.Signed.cs

分析 Utf8 字符串开头的一个 Int64 值。

public static bool TryParse(ReadOnlySpan<byte> source, out long value, out int bytesConsumed, char standardFormat = '\0');
static member TryParse : ReadOnlySpan<byte> * int64 * int * char -> bool
Public Shared Function TryParse (source As ReadOnlySpan(Of Byte), ByRef value As Long, ByRef bytesConsumed As Integer, Optional standardFormat As Char = '\0') As Boolean

参数

source
ReadOnlySpan<Byte>

要分析的 Utf8 字符串。

value
Int64

当该方法返回时,如果分析操作成功,则包含从 source中分析的值。

bytesConsumed
Int32

如果分析操作成功,则该方法返回时包含已分析子字符串的长度(以字节为单位)。 如果方法失败, bytesConsumed 则设置为 0。

standardFormat
Char

Utf8 字符串的预期格式。

返回

true 成功; false 如果字符串在语法上无效或发生溢出或下溢,则为 。

注解

支持的格式:

格式字符串 预期格式示例
G/g (默认值)
D/d 32767
N/n 32,767
X/x 7fff

适用于

TryParse(ReadOnlySpan<Byte>, SByte, Int32, Char)

Source:
Utf8Parser.Integer.Signed.cs
Source:
Utf8Parser.Integer.Signed.cs
Source:
Utf8Parser.Integer.Signed.cs
Source:
Utf8Parser.Integer.Signed.cs
Source:
Utf8Parser.Integer.Signed.cs

重要

此 API 不符合 CLS。

分析 Utf8 字符串开头的一个 SByte 值。

[System.CLSCompliant(false)]
public static bool TryParse(ReadOnlySpan<byte> source, out sbyte value, out int bytesConsumed, char standardFormat = '\0');
[<System.CLSCompliant(false)>]
static member TryParse : ReadOnlySpan<byte> * sbyte * int * char -> bool
Public Shared Function TryParse (source As ReadOnlySpan(Of Byte), ByRef value As SByte, ByRef bytesConsumed As Integer, Optional standardFormat As Char = '\0') As Boolean

参数

source
ReadOnlySpan<Byte>

要分析的 Utf8 字符串。

value
SByte

当该方法返回时,如果分析操作成功,则包含从 source中分析的值。

bytesConsumed
Int32

如果分析操作成功,则该方法返回时包含已分析子字符串的长度(以字节为单位)。 如果方法失败, bytesConsumed 则设置为 0。

standardFormat
Char

Utf8 字符串的预期格式。

返回

true 成功; false 如果字符串在语法上无效或发生溢出或下溢,则为 。

属性

注解

支持的格式:

格式字符串 预期格式示例
G/g (默认值)
D/d 122
N/n 122
X/x 7a

适用于

TryParse(ReadOnlySpan<Byte>, Single, Int32, Char)

Source:
Utf8Parser.Float.cs
Source:
Utf8Parser.Float.cs
Source:
Utf8Parser.Float.cs
Source:
Utf8Parser.Float.cs
Source:
Utf8Parser.Float.cs

分析 Utf8 字符串开头的 A Single

public static bool TryParse(ReadOnlySpan<byte> source, out float value, out int bytesConsumed, char standardFormat = '\0');
static member TryParse : ReadOnlySpan<byte> * single * int * char -> bool
Public Shared Function TryParse (source As ReadOnlySpan(Of Byte), ByRef value As Single, ByRef bytesConsumed As Integer, Optional standardFormat As Char = '\0') As Boolean

参数

source
ReadOnlySpan<Byte>

要分析的 Utf8 字符串。

value
Single

当该方法返回时,如果分析操作成功,则包含从 source中分析的值。

bytesConsumed
Int32

如果分析操作成功,则该方法返回时包含已分析子字符串的长度(以字节为单位)。 如果方法失败, bytesConsumed 则设置为 0。

standardFormat
Char

Utf8 字符串的预期格式。

返回

true 成功; false 如果字符串在语法上无效或发生溢出或下溢,则为 。

注解

支持的格式:

格式字符串 预期格式示例 注释
G/g (默认值)
F/f 12.45 固定点
E/e 1.245000e1 指数

适用于

TryParse(ReadOnlySpan<Byte>, TimeSpan, Int32, Char)

Source:
Utf8Parser.TimeSpan.cs
Source:
Utf8Parser.TimeSpan.cs
Source:
Utf8Parser.TimeSpan.cs
Source:
Utf8Parser.TimeSpan.cs
Source:
Utf8Parser.TimeSpan.cs

分析 Utf8 字符串开头的 A TimeSpan

public static bool TryParse(ReadOnlySpan<byte> source, out TimeSpan value, out int bytesConsumed, char standardFormat = '\0');
static member TryParse : ReadOnlySpan<byte> * TimeSpan * int * char -> bool
Public Shared Function TryParse (source As ReadOnlySpan(Of Byte), ByRef value As TimeSpan, ByRef bytesConsumed As Integer, Optional standardFormat As Char = '\0') As Boolean

参数

source
ReadOnlySpan<Byte>

要分析的 Utf8 字符串。

value
TimeSpan

当该方法返回时,如果分析操作成功,则包含从 source中分析的值。

bytesConsumed
Int32

如果分析操作成功,则该方法返回时包含已分析子字符串的长度(以字节为单位)。 如果方法失败, bytesConsumed 则设置为 0。

standardFormat
Char

Utf8 字符串的预期格式。

返回

true 成功; false 如果字符串在语法上无效或发生溢出或下溢,则为 。

注解

支持的格式:

格式字符串 预期格式 注释
c/t/T (默认值) [-][d.]hh:mm:ss[.fffffff] (常量格式)
G [-]d:hh:mm:ss.fffffff (一般长)
[-][d:][h]h:mm:ss[.f[f[f[f[f[f[f[f]]]]]] (一般短)

适用于

TryParse(ReadOnlySpan<Byte>, UInt16, Int32, Char)

Source:
Utf8Parser.Integer.Unsigned.cs
Source:
Utf8Parser.Integer.Unsigned.cs
Source:
Utf8Parser.Integer.Unsigned.cs
Source:
Utf8Parser.Integer.Unsigned.cs
Source:
Utf8Parser.Integer.Unsigned.cs

重要

此 API 不符合 CLS。

分析 Utf8 字符串开头的 A UInt16

[System.CLSCompliant(false)]
public static bool TryParse(ReadOnlySpan<byte> source, out ushort value, out int bytesConsumed, char standardFormat = '\0');
[<System.CLSCompliant(false)>]
static member TryParse : ReadOnlySpan<byte> * uint16 * int * char -> bool
Public Shared Function TryParse (source As ReadOnlySpan(Of Byte), ByRef value As UShort, ByRef bytesConsumed As Integer, Optional standardFormat As Char = '\0') As Boolean

参数

source
ReadOnlySpan<Byte>

要分析的 Utf8 字符串。

value
UInt16

当该方法返回时,如果分析操作成功,则包含从 source中分析的值。

bytesConsumed
Int32

如果分析操作成功,则该方法返回时包含已分析子字符串的长度(以字节为单位)。 如果方法失败, bytesConsumed 则设置为 0。

standardFormat
Char

Utf8 字符串的预期格式。

返回

true 成功; false 如果字符串在语法上无效或发生溢出或下溢,则为 。

属性

注解

支持的格式:

格式字符串 预期格式示例
G/g (默认值)
D/d 32767
N/n 32,767
X/x 7fff

适用于

TryParse(ReadOnlySpan<Byte>, UInt32, Int32, Char)

Source:
Utf8Parser.Integer.Unsigned.cs
Source:
Utf8Parser.Integer.Unsigned.cs
Source:
Utf8Parser.Integer.Unsigned.cs
Source:
Utf8Parser.Integer.Unsigned.cs
Source:
Utf8Parser.Integer.Unsigned.cs

重要

此 API 不符合 CLS。

分析 Utf8 字符串开头的 A UInt32

[System.CLSCompliant(false)]
public static bool TryParse(ReadOnlySpan<byte> source, out uint value, out int bytesConsumed, char standardFormat = '\0');
[<System.CLSCompliant(false)>]
static member TryParse : ReadOnlySpan<byte> * uint32 * int * char -> bool
Public Shared Function TryParse (source As ReadOnlySpan(Of Byte), ByRef value As UInteger, ByRef bytesConsumed As Integer, Optional standardFormat As Char = '\0') As Boolean

参数

source
ReadOnlySpan<Byte>

要分析的 Utf8 字符串。

value
UInt32

当该方法返回时,如果分析操作成功,则包含从 source中分析的值。

bytesConsumed
Int32

如果分析操作成功,则该方法返回时包含已分析子字符串的长度(以字节为单位)。 如果方法失败, bytesConsumed 则设置为 0。

standardFormat
Char

Utf8 字符串的预期格式。

返回

true 成功; false 如果字符串在语法上无效或发生溢出或下溢,则为 。

属性

注解

支持的格式:

格式字符串 预期格式示例
G/g (默认值)
D/d 32767
N/n 32,767
X/x 7fff

适用于

TryParse(ReadOnlySpan<Byte>, UInt64, Int32, Char)

Source:
Utf8Parser.Integer.Unsigned.cs
Source:
Utf8Parser.Integer.Unsigned.cs
Source:
Utf8Parser.Integer.Unsigned.cs
Source:
Utf8Parser.Integer.Unsigned.cs
Source:
Utf8Parser.Integer.Unsigned.cs

重要

此 API 不符合 CLS。

分析 Utf8 字符串开头的 A UInt64

[System.CLSCompliant(false)]
public static bool TryParse(ReadOnlySpan<byte> source, out ulong value, out int bytesConsumed, char standardFormat = '\0');
[<System.CLSCompliant(false)>]
static member TryParse : ReadOnlySpan<byte> * uint64 * int * char -> bool
Public Shared Function TryParse (source As ReadOnlySpan(Of Byte), ByRef value As ULong, ByRef bytesConsumed As Integer, Optional standardFormat As Char = '\0') As Boolean

参数

source
ReadOnlySpan<Byte>

要分析的 Utf8 字符串。

value
UInt64

当该方法返回时,如果分析操作成功,则包含从 source中分析的值。

bytesConsumed
Int32

如果分析操作成功,则该方法返回时包含已分析子字符串的长度(以字节为单位)。 如果方法失败, bytesConsumed 则设置为 0。

standardFormat
Char

Utf8 字符串的预期格式。

返回

true 成功; false 如果字符串在语法上无效或发生溢出或下溢,则为 。

属性

注解

支持的格式:

格式字符串 预期格式示例
G/g (默认值)
D/d 32767
N/n 32,767
X/x 7fff

适用于