INumberBase<TSelf>.TryParse 方法

定義

多載

TryParse(ReadOnlySpan<Byte>, NumberStyles, IFormatProvider, TSelf)

嘗試將UTF-8字元的範圍剖析為值。

TryParse(String, NumberStyles, IFormatProvider, TSelf)

嘗試將字串剖析成值。

TryParse(ReadOnlySpan<Char>, NumberStyles, IFormatProvider, TSelf)

嘗試將字元範圍剖析成值。

TryParse(ReadOnlySpan<Byte>, NumberStyles, IFormatProvider, TSelf)

來源:
INumberBase.cs
來源:
INumberBase.cs

嘗試將UTF-8字元的範圍剖析為值。

public:
 static override bool TryParse(ReadOnlySpan<System::Byte> utf8Text, System::Globalization::NumberStyles style, IFormatProvider ^ provider, [Runtime::InteropServices::Out] TSelf % result);
public static virtual bool TryParse (ReadOnlySpan<byte> utf8Text, System.Globalization.NumberStyles style, IFormatProvider? provider, out TSelf result);
static member TryParse : ReadOnlySpan<byte> * System.Globalization.NumberStyles * IFormatProvider * 'Self -> bool
Public Shared Overrides Function TryParse (utf8Text As ReadOnlySpan(Of Byte), style As NumberStyles, provider As IFormatProvider, ByRef result As TSelf) As Boolean

參數

utf8Text
ReadOnlySpan<Byte>

要剖析的UTF-8字元範圍。

style
NumberStyles

數字樣式的位元組合,可以存在於 中 utf8Text

provider
IFormatProvider

提供關於 utf8Text 之特定文化特性格式資訊的物件。

result
TSelf

傳回時,包含成功剖析 utf8Text 或失敗時未定義值的結果。

傳回

true 如果 utf8Text 已成功剖析,則為 ,否則為 false

例外狀況

style 不是支援 NumberStyles 的值。

適用於

TryParse(String, NumberStyles, IFormatProvider, TSelf)

來源:
INumberBase.cs
來源:
INumberBase.cs
來源:
INumberBase.cs

嘗試將字串剖析成值。

public:
 static bool TryParse(System::String ^ s, System::Globalization::NumberStyles style, IFormatProvider ^ provider, [Runtime::InteropServices::Out] TSelf % result);
public static abstract bool TryParse (string? s, System.Globalization.NumberStyles style, IFormatProvider? provider, out TSelf result);
static member TryParse : string * System.Globalization.NumberStyles * IFormatProvider * 'Self -> bool
Public Shared Function TryParse (s As String, style As NumberStyles, provider As IFormatProvider, ByRef result As TSelf) As Boolean

參數

s
String

要剖析的字串。

style
NumberStyles

數字樣式的位元組合,可以存在於 中 s

provider
IFormatProvider

提供關於 s 之特定文化特性格式資訊的物件。

result
TSelf

傳回時,包含失敗時可成功剖析 s 或未定義值的結果。

傳回

true 如果 s 已成功剖析,則為 ,否則為 false

例外狀況

style 不是支援 NumberStyles 的值。

適用於

TryParse(ReadOnlySpan<Char>, NumberStyles, IFormatProvider, TSelf)

來源:
INumberBase.cs
來源:
INumberBase.cs
來源:
INumberBase.cs

嘗試將字元範圍剖析成值。

public:
 static bool TryParse(ReadOnlySpan<char> s, System::Globalization::NumberStyles style, IFormatProvider ^ provider, [Runtime::InteropServices::Out] TSelf % result);
public static abstract bool TryParse (ReadOnlySpan<char> s, System.Globalization.NumberStyles style, IFormatProvider? provider, out TSelf result);
static member TryParse : ReadOnlySpan<char> * System.Globalization.NumberStyles * IFormatProvider * 'Self -> bool
Public Shared Function TryParse (s As ReadOnlySpan(Of Char), style As NumberStyles, provider As IFormatProvider, ByRef result As TSelf) As Boolean

參數

s
ReadOnlySpan<Char>

要剖析的字元範圍。

style
NumberStyles

數字樣式的位元組合,可以存在於 中 s

provider
IFormatProvider

提供關於 s 之特定文化特性格式資訊的物件。

result
TSelf

傳回時,包含失敗時可成功剖析 s 或未定義值的結果。

傳回

true 如果 s 已成功剖析,則為 ,否則為 false

例外狀況

style 不是支援 NumberStyles 的值。

適用於