IntPtr.Parse 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
多載
Parse(String, NumberStyles, IFormatProvider) |
將指定樣式與文化特性 (Culture) 特定格式之數字的字串表示法轉換成其對等帶正負號的原生整數。 |
Parse(ReadOnlySpan<Char>, NumberStyles, IFormatProvider) |
將指定樣式和文化特性特定格式之數位字元表示的唯讀範圍,轉換為其帶正負號的原生整數對等專案。 |
Parse(String) |
將數字的字串表示轉換成其對等帶正負號的原生整數。 |
Parse(String, NumberStyles) |
將指定樣式之數字的字串表示法轉換成其對等帶正負號的原生整數。 |
Parse(String, IFormatProvider) |
將指定特定文化特性 (Culture) 格式之數字的字串表示法轉換成其對等帶正負號的原生整數。 |
Parse(String, NumberStyles, IFormatProvider)
將指定樣式與文化特性 (Culture) 特定格式之數字的字串表示法轉換成其對等帶正負號的原生整數。
public:
static IntPtr Parse(System::String ^ s, System::Globalization::NumberStyles style, IFormatProvider ^ provider);
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
的特定文化特性格式資訊。
傳回
-
IntPtr
nativeint
帶正負號的原生整數,與 s
中所包含的數字相等。
實作
例外狀況
s
為 null
。
style
不是 NumberStyles 值,或 style
不是 AllowHexSpecifier 與 HexNumber 值的組合。
s
的格式不正確。
適用於
Parse(ReadOnlySpan<Char>, NumberStyles, IFormatProvider)
將指定樣式和文化特性特定格式之數位字元表示的唯讀範圍,轉換為其帶正負號的原生整數對等專案。
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
的特定文化特性格式資訊。
傳回
-
IntPtr
nativeint
帶正負號的原生整數,與 s
中所包含的數字相等。
實作
例外狀況
style
不是 NumberStyles 值,或 style
不是 AllowHexSpecifier 與 HexNumber 值的組合。
s
的格式不正確。
適用於
Parse(String)
將數字的字串表示轉換成其對等帶正負號的原生整數。
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
字串,包含要轉換的數字。
傳回
-
IntPtr
nativeint
帶正負號的原生整數,與 s
中所包含的數字相等。
例外狀況
s
為 null
。
s
的格式不正確。
適用於
Parse(String, NumberStyles)
將指定樣式之數字的字串表示法轉換成其對等帶正負號的原生整數。
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
中可以存在的樣式項目。
傳回
-
IntPtr
nativeint
帶正負號的原生整數,與 s
中所包含的數字相等。
例外狀況
s
為 null
。
style
不是 NumberStyles 值,或 style
不是 AllowHexSpecifier 與 HexNumber 值的組合。
s
的格式不正確。
適用於
Parse(String, IFormatProvider)
將指定特定文化特性 (Culture) 格式之數字的字串表示法轉換成其對等帶正負號的原生整數。
public:
static IntPtr Parse(System::String ^ s, IFormatProvider ^ provider);
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
的特定文化特性格式資訊。
傳回
-
IntPtr
nativeint
帶正負號的原生整數,與 s
中所包含的數字相等。
實作
例外狀況
s
為 null
。
s
的格式不正確。