Hi,

How to convert "1283912839E-5" string (in scientific format) to a decimal.

Convert.ToDecimal("1283912839E-5") is throwing "Input string is not in
correct format" exception. Is the exponential format not supported during
conversion?

I think we need to use NumberFormatInfo, but dont know how to use the format
specifiers in the NumberFormatInfo.

Thanks in advance.

Re: HOWTO: Convert a string in scientific format to a decimal by Chris

Chris
Fri Feb 20 22:51:30 CST 2004

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

Chris R.

"Krish" <krish_epal@hotmail.com> wrote in message
news:enwRwlC#DHA.2524@TK2MSFTNGP11.phx.gbl...
> Hi,
>
> How to convert "1283912839E-5" string (in scientific format) to a decimal.
>
> Convert.ToDecimal("1283912839E-5") is throwing "Input string is not in
> correct format" exception. Is the exponential format not supported during
> conversion?
>
> I think we need to use NumberFormatInfo, but dont know how to use the
format
> specifiers in the NumberFormatInfo.
>
> Thanks in advance.
>
>
>
>



Re: HOWTO: Convert a string in scientific format to a decimal by Krish

Krish
Sat Feb 21 12:50:07 CST 2004

Thanks a lot!!

"Chris R" <sothryn@hotmail.com> wrote in message
news:eTWtdZD#DHA.3068@tk2msftngp13.phx.gbl...
> string x = "1283912839E-5";
> decimal dec = Decimal.Parse( x, NumberStyles.AllowExponent );
>
> Chris R.
>
> "Krish" <krish_epal@hotmail.com> wrote in message
> news:enwRwlC#DHA.2524@TK2MSFTNGP11.phx.gbl...
> > Hi,
> >
> > How to convert "1283912839E-5" string (in scientific format) to a
decimal.
> >
> > Convert.ToDecimal("1283912839E-5") is throwing "Input string is not in
> > correct format" exception. Is the exponential format not supported
during
> > conversion?
> >
> > I think we need to use NumberFormatInfo, but dont know how to use the
> format
> > specifiers in the NumberFormatInfo.
> >
> > Thanks in advance.
> >
> >
> >
> >
>
>