Double.Parse、Double.TryParse、IsNumeric 使用注意事項
Module Module1
Sub Main()
Dim values = New String() {"不是一個數字", "正無窮大", "負無窮大"}
For Each value In values
Dim convertedValue = 0.0
Dim result = Double.TryParse(value, convertedValue)
Console.WriteLine("value: {0}", value)
Console.WriteLine("Double.TryParse(value, convertedValue): {0} ({1})", result, convertedValue)
Console.WriteLine("Double.Parse(value): {0}", Double.Parse(value))
Console.WriteLine("IsNumeric(value): {0}", IsNumeric(value))
Console.WriteLine(New String("=", 78))
Next
End Sub
End Module