Replace decimal separator

studio

#1

Hello,
We use data scrapping to obtain exchange rates from a website.
The result is stored in a Data Table and written in an Excel file.
We have the following issue…
On the website, the decimal separator is a comma and the thousand separator is a white space.
But once in Excel, the result is different…
For example :
For 1 EUR you have 1,607.54 MMK written 1 607,5400 on the website we use.
In Excel the result is 1 607,5400 and is not considered as a number.
How can we manage this issue ?
Thanks for your help


#2

Hi,

looks like The input number format itself is wrong.
So, we need to remove white space first for that you can use the below options

Option 1: use String replace function
XYZ.Replace(" “,String.Empty) or XYZ.Replace(” “,”")

Option 2: Use Regex
XYZ = Regex.Replace(XYZ, @"\s", “”)

after you remove the space again you replace comma (,) with Dot(.)