dcsimg
Results 1 to 3 of 3

Thread: [RESOLVED] How to Parse this string: 8.29933968E-04 into some number?

  1. #1

    Thread Starter
    Member
    Join Date
    Mar 2012
    Posts
    49

    Resolved [RESOLVED] How to Parse this string: 8.29933968E-04 into some number?

    Hi guys, I'm using vb2010.
    Trying to parse this string 8.29933968E-04 into a number so I can plot in on a spreadsheet.


    if this number were like 1283912839E-5(that is, 'integer'&(E-xxx) , without the decimal point in the number ) , then I could've used

    string x = "1283912839E-5"
    decimal dec = Decimal.Parse( x, NumberStyles.AllowExponent )


    But not for my number.
    What should I do?

    Thank you guys

  2. #2
    PowerPoster stanav's Avatar
    Join Date
    Jul 2006
    Location
    Providence, RI - USA
    Posts
    9,292

    Re: How to Parse this string: 8.29933968E-04 into some number?

    Try this:
    Code:
    Dim x As String = "8.29933968E-04"
    Dim num As Decimal = Decimal.Parse(x, Globalization.NumberStyles.AllowExponent Or Globalization.NumberStyles.AllowDecimalPoint)
    Let us have faith that right makes might, and in that faith, let us, to the end, dare to do our duty as we understand it.
    - Abraham Lincoln -

  3. #3

    Thread Starter
    Member
    Join Date
    Mar 2012
    Posts
    49

    Re: How to Parse this string: 8.29933968E-04 into some number?

    this worked for me
    Code:
    dec = decimal.Parse(x, System.Globalization.NumberStyles.Float)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Featured


Click Here to Expand Forum to Full Width