I want to convert a string to a number.
But some strings have a normal char in it like: 543p
How can delete all chars, instead of all chars that are normal in a decimal ?
Jelmer850iHow can delete all chars, instead of all chars that are normal in a decimal ?
You can filter out special characters and other alphabets using Int.TryParse method
string input = "45234&^&#@$^*367213p";
int number = 0;
input = string.Join("", input.ToCharArray().Where(a => Int32.TryParse(a.ToString(), out number)));