Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
100 >> Zufalls String berechnen Basics source = "1234,567 abc"; result = source.StartsWithNumber(false); if (result > 0) { double number = Convert.ToDouble(source.Substring(0, result)); Console.WriteLine("'{0}' beginnt mit der Dezimalzahl {1}", source, number); } else { Console.WriteLine("'{0}' beginnt nicht mit einer Dezimalzahl", source); } Listing 47: Ermitteln, ob ein String mit einer Zahl beginnt, und Extrahieren dieser Zahl (Forts.) Abbildung 25: Das Beispielprogramm in Aktion