Here is a code snippet for removing non-numeric characters in C#.
- Advertisement -
/// <summary>
/// Method deletes all non numeric characters from passed text
/// </summary>
/// <param name="text">string text</param>
/// <returns>string text without non-numeric characters</returns>
public static string RemoveNonNumeric(string text)
{
string newText = "";
if(String.IsNullOrEmpty(text))
{
return newText;
}
newText = Regex.Replace(text, "[^0-9]", "");
return newText;
}
- Advertisement -
- Advertisement -