Converts string to double floating-point number : double parse « Data Types « C# / C Sharp






Converts string to double floating-point number

  

using System;

public class Example
{
   public static void Main()
   {
       string value;
    
       value = Double.MinValue.ToString();
       try {
          Console.WriteLine(Double.Parse(value));
       }   
       catch (OverflowException) {
          Console.WriteLine("{0} is outside the range of the Double type.",
                            value);
       }
    
       value = Double.MaxValue.ToString();
       try {
          Console.WriteLine(Double.Parse(value));
       }
       catch (OverflowException) {
          Console.WriteLine("{0} is outside the range of the Double type.",
                            value);
       }

   }
}

   
    
  








Related examples in the same category

1.Converts string in a culture-specific format to double
2.Parse a string in exponential notation with only the AllowExponent flag
3.Parse a string in exponential notation with the AllowExponent and Number flags.
4.Parse a currency value with leading/trailing white space and white space after the U.S. currency symbol.
5.Parse negative value with thousands separator and decimal.
6.Parse a floating-point value with a thousands separator.
7.Parse a floating-point value with a currency symbol and a thousands separator.
8.Parse value in exponential notation.
9.Parse a negative integer value.
10.Double TryParse, NumberStyles.AllowDecimalPoint
11.Double TryParse, NumberStyles.AllowDecimalPoint | NumberStyles.AllowThousands
12.Format decimal with currency format
13.double value parse: NumberStyles.AllowParentheses | NumberStyles.AllowTrailingSign | NumberStyles.Float | NumberStyles.AllowThousands
14.Converts string in a specified style and culture-specific format to double
15.Use TryParse to Convert string to double