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