Hi all,
I am trying to write a function which accepts a string as input and gives the integer as output,
The string can be in any of these format for ex:2,500.75 or 2.500,7501 or 2'500.7513 or 2500,254 the output of function should be like 2500.56

Basically trying to get rid of the thousand separator which can be either a comma,or apostrophe. ..

I request you experts to help me out at the earliest....
waiting for your replies ...thanks in advance....

Recommended Answers

All 2 Replies

Regular expression :

Dim regx = New System.Text.RegularExpressions.Regex("[,']")
Dim v1 = regx.Replace("2,500.75", "")

Regular expression :

Dim regx = New System.Text.RegularExpressions.Regex("[,']")
Dim v1 = regx.Replace("2,500.75", "")

Thank you for your reply..
This works fine if the data is in this format..2,500.78 and 2'500.78

but what if the data is in this format like 2'500,78 and 2,500'78 i mean the thousand separator are changed to these formats then it wont work!!!!!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.