I have this method that takes a string and only gets the numbers from it and trims the white spaces but it is not working:
public static string ToNumericOnlyFAX(this string input)
{
if (input == "OFF6239750")
{
input = Regex.Replace(input, "[^0-9']", " "); - becomes " 6239750"
input.TrimStart().Trim().TrimEnd(); - after any of these its still the above, I want it to be "6239750"
if (input.Length <= 10 && input == "6239750") - if the above works then I can padleft
{
input.PadLeft(10, '0');
}
}
return input;
}
how to I trim the string if the white spaces are in between the numbers such ass 603 123 4321???