Hey Im looking to strip out non-numeric characters in a string in ASP.NET C#
So i.e 40,595 p.a.
would end up with 40595
Thanks
Feels like a good fit for a regular expression.
var s = "40,595 p.a."; var stripped = Regex.Replace(s, "[^0-9]", "");
"[^0-9]" can be replaced by @"\D" but I like the readability of [^0-9].
"[^0-9]"
@"\D"
[^0-9]