473,383 Members | 1,892 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,383 software developers and data experts.

HOWTO: Convert a string in scientific format to a decimal

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.


Nov 15 '05 #1
4 17828
string x = "1283912839E-5";
decimal dec = Decimal.Parse( x, NumberStyles.AllowExponent );

Chris R.

"Krish" <kr********@hotmail.com> wrote in message
news:en**************@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.

Nov 15 '05 #2
string x = "1283912839E-5";
decimal dec = Decimal.Parse( x, NumberStyles.AllowExponent );

Chris R.

"Krish" <kr********@hotmail.com> wrote in message
news:en**************@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.

Nov 15 '05 #3
Thanks a lot!!

"Chris R" <so*****@hotmail.com> wrote in message
news:eT**************@tk2msftngp13.phx.gbl...
string x = "1283912839E-5";
decimal dec = Decimal.Parse( x, NumberStyles.AllowExponent );

Chris R.

"Krish" <kr********@hotmail.com> wrote in message
news:en**************@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.


Nov 15 '05 #4
Thanks a lot!!

"Chris R" <so*****@hotmail.com> wrote in message
news:eT**************@tk2msftngp13.phx.gbl...
string x = "1283912839E-5";
decimal dec = Decimal.Parse( x, NumberStyles.AllowExponent );

Chris R.

"Krish" <kr********@hotmail.com> wrote in message
news:en**************@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.


Nov 15 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Krish | last post by:
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...
3
by: Harry Keck | last post by:
I would imagine that this is a pretty trivial operation, but I can not figure out how to cast a string variable to a Decimal. I tried Decimal dVariable = (Decimal)strStringVariable, but it does not...
2
by: KB | last post by:
Hi guys, In my DataGrid I have a column that displays decimal values as currency ( I set the Data Formatting expression of that column to {0:C}). So the actual string displayed in the grid looks...
0
by: Martyn Fewtrell | last post by:
Hi there I'm sure there is a straight forward answer to this but I haven't quite got there. If I have a String in Sterling Currency Format and try to convert this to a Decimal (for arithmetic...
3
by: dermot | last post by:
None of the Converter tyeps (eg ASCIIEncoding )let you convert between string and 8-bit bytes (0-255). It took me a long time to find there is a way, well, at least 2 ways.....here is the way to...
15
by: shiniskumar | last post by:
How to convert string to double? Ive got a double variable dTot; its value is 5.037717235E7 when i did FreemarkerTools.formatDecimal(dTot) i got it as string "50377172.35". now i want to...
4
by: sweatha | last post by:
Hi In sql server 2005 I have a column as GraduationYear Decimal(4,0). In asp.net I used the coding for that as SqlParameter GraduationYear = new SqlParameter("@GraduationYear",...
8
code green
by: code green | last post by:
I am being sent a CSV file with ID numbers somehow converted to scientific format ie 1.93E+11 and 3.70E+9. In theory the same thing could happen to telephone numbers or even currency. I am trying...
1
by: lenora | last post by:
How to convert string to decimal ? input - output 45 - 45.00 45.5 - 45.50 45.51 - 45.51 Thank you in advance
3
by: tanishka singh | last post by:
How do you convert string from database into date in asp.net? Dim output = (From tlb In obj.SelectRecordAll_SalesInquiryRegister _ Join tlb1 In LatestPOs On tlb.SIR_OfferNo...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.