C# Extension Method for String Data Type
- by Jimbo
My web application deals with strings that need to be converted to numbers alot - users often put commas, currency symbols etc. in these fields so what I want to do is create a string extension method that cleans the field up and converts it to a decimal.
For example:
decimal myNumber = "$1,250.85".ToDecimal();
Can anyone help with this? Thanks!