|
Dieser Artikel wurde maschinell übersetzt. Bewegen Sie den Mauszeiger über die Sätze im Artikel, um den Originaltext anzuzeigen. Weitere Informationen
|
Übersetzung
Original
|
Int32.Parse-Methode (String)
Namespace: System
Assembly: mscorlib (in mscorlib.dll)
Parameter
- s
- Typ: System.String
Eine Zeichenfolge, die die zu konvertierende Zahl enthält.
| Ausnahme | Bedingung |
|---|---|
| ArgumentNullException | |
| FormatException | |
| OverflowException |
using System; public class ParseInt32 { public static void Main() { Convert(" 179 "); Convert(" -204 "); Convert(" +809 "); Convert(" 178.3"); } private static void Convert(string value) { try { int number = Int32.Parse(value); Console.WriteLine("Converted '{0}' to {1}.", value, number); } catch (FormatException) { Console.WriteLine("Unable to convert '{0}'.", value); } } } // This example displays the following output to the console: // Converted ' 179 ' to 179. // Converted ' -204 ' to -204. // Converted ' +809 ' to 809. // Unable to convert ' 178.3'.
Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core-Rolle wird nicht unterstützt), Windows Server 2008 R2 (Server Core-Rolle wird mit SP1 oder höher unterstützt; Itanium wird nicht unterstützt)
.NET Framework unterstützt nicht alle Versionen sämtlicher Plattformen. Eine Liste der unterstützten Versionen finden Sie unter Systemanforderungen für .NET Framework.