Converting string "2 1/2" to double

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Valerie Hough

    #1

    Converting string "2 1/2" to double

    Is there a C# class that will help convert strings that include fractions
    ( "2 1/2" e.g.) to doubles ? Convert.ToDoubl e() throws an invalid input
    format exception.

    Obviously I can write code to do it but this seems like a fairly normal
    thing to want to do and I would expect C# to have already built in support.

    Can anyone help? Even unmanaged code would do.

    Brian Hough


  • Bruce Wood

    #2
    Re: Converting string "2 1/2" to double

    Nope. There's nothing in the Framework.

    I wrote my own Fraction class, which I would be happy to share with
    you. I'll send a message to you directly.

    Comment

    Working...