Half.Parse 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
多載
Parse(String) |
將數字的字串表示法轉換為其對等半精確度浮點數。 |
Parse(ReadOnlySpan<Byte>, IFormatProvider) |
將 UTF-8 字元的範圍剖析為值。 |
Parse(ReadOnlySpan<Char>, IFormatProvider) |
將字元範圍剖析為值。 |
Parse(String, NumberStyles) |
將數字的字串表示 (使用指定樣式) 轉換為其對等單精確度浮點數。 |
Parse(String, IFormatProvider) |
將數字的字串表示 (使用指定的特定文化特性格式) 轉換為其對等單精確度浮點數。 |
Parse(ReadOnlySpan<Byte>, NumberStyles, IFormatProvider) |
將 UTF-8 字元的範圍剖析為值。 |
Parse(ReadOnlySpan<Char>, NumberStyles, IFormatProvider) |
將數字的字串表示 (使用指定樣式和的特定文化特性格式) 轉換為其對等單精確度浮點數。 |
Parse(String, NumberStyles, IFormatProvider) |
將數字的字串表示 (使用指定樣式和的特定文化特性格式) 轉換為其對等單精確度浮點數。 |
Parse(String)
- 來源:
- Half.cs
- 來源:
- Half.cs
- 來源:
- Half.cs
將數字的字串表示法轉換為其對等半精確度浮點數。
public:
static Half Parse(System::String ^ s);
public static Half Parse (string s);
static member Parse : string -> Half
Public Shared Function Parse (s As String) As Half
參數
- s
- String
字串,其包含要轉換的數字。
傳回
半精確度浮點數,其相當於 s
中指定的數值或符號。
例外狀況
s
為 null
。
s
不是有效格式的數字。
適用於
Parse(ReadOnlySpan<Byte>, IFormatProvider)
- 來源:
- Half.cs
- 來源:
- Half.cs
將 UTF-8 字元的範圍剖析為值。
public:
static Half Parse(ReadOnlySpan<System::Byte> utf8Text, IFormatProvider ^ provider) = IUtf8SpanParsable<Half>::Parse;
public static Half Parse (ReadOnlySpan<byte> utf8Text, IFormatProvider? provider);
static member Parse : ReadOnlySpan<byte> * IFormatProvider -> Half
Public Shared Function Parse (utf8Text As ReadOnlySpan(Of Byte), provider As IFormatProvider) As Half
參數
- utf8Text
- ReadOnlySpan<Byte>
要剖析的 UTF-8 字元範圍。
- provider
- IFormatProvider
提供關於 utf8Text
之特定文化特性格式資訊的物件。
傳回
剖析 utf8Text
的結果。
實作
適用於
Parse(ReadOnlySpan<Char>, IFormatProvider)
- 來源:
- Half.cs
- 來源:
- Half.cs
- 來源:
- Half.cs
將字元範圍剖析為值。
public:
static Half Parse(ReadOnlySpan<char> s, IFormatProvider ^ provider) = ISpanParsable<Half>::Parse;
public static Half Parse (ReadOnlySpan<char> s, IFormatProvider? provider);
static member Parse : ReadOnlySpan<char> * IFormatProvider -> Half
Public Shared Function Parse (s As ReadOnlySpan(Of Char), provider As IFormatProvider) As Half
參數
- s
- ReadOnlySpan<Char>
要剖析的字元範圍。
- provider
- IFormatProvider
提供關於 s
之特定文化特性格式資訊的物件。
傳回
剖析 s
的結果。
實作
適用於
Parse(String, NumberStyles)
- 來源:
- Half.cs
- 來源:
- Half.cs
- 來源:
- Half.cs
將數字的字串表示 (使用指定樣式) 轉換為其對等單精確度浮點數。
public:
static Half Parse(System::String ^ s, System::Globalization::NumberStyles style);
public static Half Parse (string s, System.Globalization.NumberStyles style);
static member Parse : string * System.Globalization.NumberStyles -> Half
Public Shared Function Parse (s As String, style As NumberStyles) As Half
參數
- s
- String
字串,其包含要轉換的數字。
- style
- NumberStyles
列舉值的位元組合,表示 s
中可以存在的樣式項目。
傳回
半精確度浮點數,其相當於 s
中指定的數值或符號。
例外狀況
s
為 null
。
s
不是有效格式的數字。
適用於
Parse(String, IFormatProvider)
- 來源:
- Half.cs
- 來源:
- Half.cs
- 來源:
- Half.cs
將數字的字串表示 (使用指定的特定文化特性格式) 轉換為其對等單精確度浮點數。
public:
static Half Parse(System::String ^ s, IFormatProvider ^ provider);
public:
static Half Parse(System::String ^ s, IFormatProvider ^ provider) = IParsable<Half>::Parse;
public static Half Parse (string s, IFormatProvider? provider);
static member Parse : string * IFormatProvider -> Half
Public Shared Function Parse (s As String, provider As IFormatProvider) As Half
參數
- s
- String
字串,其包含要轉換的數字。
- provider
- IFormatProvider
物件,提供關於 s
的特定文化特性格式資訊。
傳回
半精確度浮點數,其相當於 s
中指定的數值或符號。
實作
例外狀況
s
為 null
。
s
不是有效格式的數字。
適用於
Parse(ReadOnlySpan<Byte>, NumberStyles, IFormatProvider)
- 來源:
- Half.cs
- 來源:
- Half.cs
將 UTF-8 字元的範圍剖析為值。
public static Half Parse (ReadOnlySpan<byte> utf8Text, System.Globalization.NumberStyles style = System.Globalization.NumberStyles.AllowThousands | System.Globalization.NumberStyles.Float, IFormatProvider? provider = default);
static member Parse : ReadOnlySpan<byte> * System.Globalization.NumberStyles * IFormatProvider -> Half
Public Shared Function Parse (utf8Text As ReadOnlySpan(Of Byte), Optional style As NumberStyles = System.Globalization.NumberStyles.AllowThousands | System.Globalization.NumberStyles.Float, Optional provider As IFormatProvider = Nothing) As Half
參數
- utf8Text
- ReadOnlySpan<Byte>
要剖析的 UTF-8 字元範圍。
- style
- NumberStyles
數位樣式的位元組合,可以存在於 中 utf8Text
。
- provider
- IFormatProvider
提供關於 utf8Text
之特定文化特性格式資訊的物件。
傳回
剖析 utf8Text
的結果。
實作
適用於
Parse(ReadOnlySpan<Char>, NumberStyles, IFormatProvider)
- 來源:
- Half.cs
- 來源:
- Half.cs
- 來源:
- Half.cs
將數字的字串表示 (使用指定樣式和的特定文化特性格式) 轉換為其對等單精確度浮點數。
public static Half Parse (ReadOnlySpan<char> s, System.Globalization.NumberStyles style = System.Globalization.NumberStyles.AllowThousands | System.Globalization.NumberStyles.Float, IFormatProvider? provider = default);
static member Parse : ReadOnlySpan<char> * System.Globalization.NumberStyles * IFormatProvider -> Half
Public Shared Function Parse (s As ReadOnlySpan(Of Char), Optional style As NumberStyles = System.Globalization.NumberStyles.AllowThousands | System.Globalization.NumberStyles.Float, Optional provider As IFormatProvider = Nothing) As Half
參數
- s
- ReadOnlySpan<Char>
將數字的字串表示法轉換為其對等半精確度浮點數。 傳回值,該值指出轉換成功或失敗。
- style
- NumberStyles
列舉值的位元組合,其表示 s
中可以存在的樣式項目。
- provider
- IFormatProvider
物件,其提供關於 s
的特定文化特性格式資訊。
傳回
半精確度浮點數,其相當於 s
中指定的數值或符號。
實作
例外狀況
s
不是有效格式的數字。
適用於
Parse(String, NumberStyles, IFormatProvider)
- 來源:
- Half.cs
- 來源:
- Half.cs
- 來源:
- Half.cs
將數字的字串表示 (使用指定樣式和的特定文化特性格式) 轉換為其對等單精確度浮點數。
public static Half Parse (string s, System.Globalization.NumberStyles style = System.Globalization.NumberStyles.AllowThousands | System.Globalization.NumberStyles.Float, IFormatProvider? provider = default);
static member Parse : string * System.Globalization.NumberStyles * IFormatProvider -> Half
Public Shared Function Parse (s As String, Optional style As NumberStyles = System.Globalization.NumberStyles.AllowThousands | System.Globalization.NumberStyles.Float, Optional provider As IFormatProvider = Nothing) As Half
參數
- s
- String
字串,其包含要轉換的數字。
- style
- NumberStyles
列舉值的位元組合,表示 s
中可以存在的樣式項目。
- provider
- IFormatProvider
物件,其提供關於 s
的特定文化特性格式資訊。
傳回
半精確度浮點數,其相當於 s
中指定的數值或符號。
實作
例外狀況
s
為 null
。
s
不是有效格式的數字。
適用於
意見反應
https://aka.ms/ContentUserFeedback。
即將登場:在 2024 年,我們將逐步淘汰 GitHub 問題作為內容的意見反應機制,並將它取代為新的意見反應系統。 如需詳細資訊,請參閱:提交並檢視相關的意見反應