473,387 Members | 1,420 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,387 software developers and data experts.

Currency issue

I know how to convert a number into a string containing the local currency,
but does anyone know how to do the opposite?
Aug 23 '06 #1
3 808
In fact it is not important, not any value holds the currency.

However the most that looks like it is.

dim a as decimal = Cdec(string)
"Stuart Nathan" <st***********@homecall.co.ukschreef in bericht
news:Od**************@TK2MSFTNGP06.phx.gbl...
>I know how to convert a number into a string containing the local currency,
but does anyone know how to do the opposite?

Aug 23 '06 #2
Actually I wanted to convert £123,456.10 to 123456.1

I solved this by
r="£123,456.10"

r = r.Replace(CultureInfo.CurrentCulture.NumberFormat. CurrencySymbol, "") '
removes £
r = r.Replace(",", "") ' removes comma
Return Val(r)
Aug 23 '06 #3

"Stuart Nathan" <st***********@homecall.co.ukwrote in message
news:eK***************@TK2MSFTNGP02.phx.gbl...
Actually I wanted to convert £123,456.10 to 123456.1

I solved this by
r="£123,456.10"

r = r.Replace(CultureInfo.CurrentCulture.NumberFormat. CurrencySymbol, "")
' removes £
r = r.Replace(",", "") ' removes comma
Return Val(r)
Dim inValue As String = "£123,456.10"
Dim outValue As Double
Dim result As Boolean

' Try to parse the inValue and store the actual numeric value in
' outValue.
result = Double.TryParse( _
inValue, _
NumberStyles.Currency, _
NumberFormatInfo.CurrentInfo, _
outValue _
)

If result
Console.WriteLine("The parsed value is " & outValue.ToString())
Else
Console.WriteLine("Could not parse the value.")
End If

HTH :)

Mythran

Aug 23 '06 #4

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

Similar topics

4
by: J P Singh | last post by:
Hi Guys I am trying to store the currency symbol used for a trasaction in a database field but rather than store £ it stores £ (see the wierd character at the beginning of the symbol) instead....
2
by: Willing 2 Learn | last post by:
I'm still having trouble getting my program to do arithmetic in cents(keeping all #'s) then convert the answer in a format of dollars & cents. The main program should add, subtract, scalar...
2
by: Dalan | last post by:
This should not be an issue, but it is. I'm sure that someone knows what little piece of code is needed too persuade Access 97 to include a currency format for labels (Avery, mailing type). Have...
0
by: ashish | last post by:
hi All, Iam having a webapplication which when run under French culture info displays value of euro currency in this format 0.00 E, (E being the euro symbol, dont know how to type it here ) ...
3
by: Vlad | last post by:
Hi, I am trying to display a currency value formated according to the current culture in ASP.NET: decimal x = 125345.54M; string currencyString = String.Format("{0:c}",x); what gets retured is...
1
by: Parveen | last post by:
This is a pretty simple issue to solve...but i can't seem to figure it out!! I want data in some columns to show as currency so I set the format of a column to currency through code by ...
1
by: Manuel Canas | last post by:
I'm stuck here guys, need some help. I have a form with a couple fo tabs on it. I load a table in each for each tab. I populate a listbox with a list of names. Then I use currency manager to...
2
by: crferguson | last post by:
Hello all! I'm having the oddest issue trying to format a numeric string as currency without decimals. For instance... strSalary = "120000.56" strSalary = Format(strSalary, "$#,##0") 'this...
18
by: Boris Yeltsin | last post by:
OK, I have a database table, it has prices of products in it, like so: ProductPrice MONEY ProductIsoCurrencyCode CHAR(3) Now, both CultureInfo and RegionInfo have...
16
by: xjohnx | last post by:
Hi, I'm hoping someone can help me I am quite new to Javascript and have had to create a programme which converts dollars into euros and vice versa, here is my script which is working var...
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: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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...
0
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...

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.