473,498 Members | 2,021 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

how to convert a String value to double value after formatting

58 New Member
Ive got a double variable dTotal =5.037717235E7
i formatted it using
deciFormat.format(dTotal) and got the String value of dTotal=50377172.35

now i have to pass this value as an argument to a function

convert(double num);


how can i convert the string value 50377172.35 to double?

Please help
Mar 12 '07 #1
8 3902
r035198x
13,262 MVP
Ive got a double variable dTotal =5.037717235E7
i formatted it using
deciFormat.format(dTotal) and got the String value of dTotal=50377172.35

now i have to pass this value as an argument to a function

convert(double num);


how can i convert the string value 50377172.35 to double?

Please help
Expand|Select|Wrap|Line Numbers
  1.  Double.parseDouble(dTotal);
Mar 12 '07 #2
r035198x
13,262 MVP
Ive got a double variable dTotal =5.037717235E7
i formatted it using
deciFormat.format(dTotal) and got the String value of dTotal=50377172.35

now i have to pass this value as an argument to a function

convert(double num);


how can i convert the string value 50377172.35 to double?

Please help
Expand|Select|Wrap|Line Numbers
  1.  Double.parseDouble(dTotal);
Mar 12 '07 #3
shiniskumar
58 New Member
Expand|Select|Wrap|Line Numbers
  1.  Double.parseDouble(dTotal);
Double.parseDouble(deciFormat.format(dTotal)) gives me 5.037717235E7

i need to get 50377172.35 as argument
Mar 12 '07 #4
shiniskumar
58 New Member
Double.parseDouble(deciFormat.format(dTotal)) gives me 5.037717235E7

i need to get 50377172.35 as argument
Please help
Mar 12 '07 #5
r035198x
13,262 MVP
Double.parseDouble(deciFormat.format(dTotal)) gives me 5.037717235E7

i need to get 50377172.35 as argument
But they are equivalent.

If the function is expecting a double then pass it the value like 5.037717235E7 it doesn't matter. Why do you want to make it 50377172.35? first.
Mar 12 '07 #6
shiniskumar
58 New Member
But they are equivalent.

If the function is expecting a double then pass it the value like 5.037717235E7 it doesn't matter. Why do you want to make it 50377172.35? first.
I need to split this number into two integers so that i can print the total in words

ie the number b4 "." will be in rupees and the number after "." will be paise part.

Thus i get error when something with E7 comes in integer part
Mar 12 '07 #7
shiniskumar
58 New Member
help please
Mar 12 '07 #8
r035198x
13,262 MVP
I need to split this number into two integers so that i can print the total in words

ie the number b4 "." will be in rupees and the number after "." will be paise part.

Thus i get error when something with E7 comes in integer part
Do not pass it as double then. Parse it a String
You can then use
Expand|Select|Wrap|Line Numbers
  1.  String s= "50377172.35"; 
  2. String[] values = s.split("\\.");
  3.  
Which gives you an array of the value split on the .
Mar 12 '07 #9

Sign in to post your reply or Sign up for a free account.

Similar topics

4
47046
by: cindy liu | last post by:
Hi, In .Net, how to convert a string to a double? Thanks in advance! Cindy
2
4949
by: Pascal | last post by:
Why does this not work, and how should i do this convert in stead: string x = double.MinValue.ToString(); double y = Convert.ToDouble(x); i get this exception: An unhandled exception of type...
2
10575
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...
3
12877
by: JenHu | last post by:
Hi all, I have to read from a text file and generate values and insert to database. But first of all, when the text file contains '0000000000', I received a sEfundAmt value = 0D instead of 0.0...
17
4337
by: David Scemama | last post by:
Hi, I'm writing a program using VB.NET that needs to communicate with a DOS Pascal program than cannot be modified. The communication channel is through some file databases, and I have a huge...
2
6589
by: Jason | last post by:
In VB.NET, when I use System.Convert.ToDouble(string Val) to convert a string variable to double variable, I got something interesting: Dim stringVal As String = "101.01" Dim doubleVal As Double...
43
8375
by: Steven T. Hatton | last post by:
http://public.research.att.com/~bs/bs_faq2.html#int-to-string Is there no C library function that will take an int and convert it to its ascii representation? The example Bjarne shows in his faq...
4
4501
by: Edwin Knoppert | last post by:
In my code i use the text from a textbox and convert it to a double value. I was using Convert.ToDouble() but i'm used to convert comma to dot. This way i can assure the text is correct. However...
2
1320
by: Derek Hart | last post by:
I have a double stored in a DataTable: dt.Rows(i)(MergeFieldName) I want to format this and store it into a string. I have formatting stored in a database, such as "$#,##0.00"
0
7121
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7162
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7197
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
6881
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7375
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5456
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
3078
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1411
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
650
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.