how to convert value with decimal point into value with decimal comma

Hello,

 I like to know how I can change (for example) the value 55.55 into 55,55. (The system in my country is using comma's instead of points)

I'm starting with  a string with the value "55.55"

Then I will convert it to a double 55,55

Do I need the the system.Globalization namespace or is there just a simple solution?

 

 

 

 

 

 

 

0
jaap
11/6/2007 1:53:25 PM
asp.net.getting-started 91979 articles. 3 followers. Follow

6 Replies
1107 Views

Similar Articles

[PageSpeed] 22

Hi,

If you are just going to use this format for display then it would be easy to do this:

double dTemp;
dTemp = 55.55;
Response.Write(dTemp.ToString().Replace(".",","));

Hope this helps. 


 


Best Regards,
Raja

MCAD .Net, MCDBA
Please choose "Mark as Answer" for the post that leads you to a solution
0
raja
11/6/2007 2:24:41 PM

Wouldn't it be easier to store the values as doubles with decimals, and then display values as a string with a comma?

0
Aeson07
11/6/2007 2:25:27 PM

I need to store the value in a sqldatabase

0
jaap
11/6/2007 3:25:59 PM

But can't you store them as decimals and then format them to strings whenever you have to pull them out and display them?

0
Aeson07
11/6/2007 3:31:47 PM

 I did the following with replace

 dim sTemp as string  = 55.55

sTemp = sTemp replace (".",",")

dim dTemp as double = sTemp

0
jaap
11/6/2007 3:41:47 PM

If you are getting a string "55.55" & want to convert into "55,55" then best method is to use String.Replace(".",",").

But if you wan to store any decimal value into SQL DB then make the column as float in database

Convert your string value "55.55" directly to decimal, by using Convert.ToDecimal(some value)


Please mark helpful posts as "Answer"
0
CJhalani
11/6/2007 3:43:25 PM
Reply: