3
Reply

Exclude Non-Numeric Problem

Ask a question
Emphatic

Emphatic

8y
326
1
string s= oElement2.InnerText;
 
string nonNumericValue = string.Concat(s.Where(a => !Char.IsDigit(a)));
double dblPrice = Convert.ToDouble(s);

I am parsing a webpage and the result "1,500\r\nIn Stock" crashes my application. I am trying to exclude all the nonnumeric characters. Is this Lambda Expression incorrect ? thank you in Advance.


Answers (3)