3
Answers

Exclude Non-Numeric Problem

Photo of Emphatic

Emphatic

9y
694
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)