I am using following code to remove currency symbol and comma from number. This is deceimal number so . is expected
private string CleanCurrencyAmount(string no)
{
no = "£67609.787";
string returnVal = string.Empty;
string rgxPattern = @"(\p{Sc})?"; // this doesn't remove comma
Regex rgx = new Regex(rgxPattern);
string x = rgx.Replace(no, "");
string clean = Regex.Replace(no, "[^A-Za-z0-9 ]", ""); // this remove . too
return returnVal;
}
>Solution :
You’re close. Change to a character class with comma:
@"[\p{Sc},]"
Then replace with an empty string.