Skip to content

Instantly share code, notes, and snippets.

@DorukUlucay
Created September 20, 2018 07:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save DorukUlucay/9c0de502ebc8e4af6b1c7e6036c9b971 to your computer and use it in GitHub Desktop.
Save DorukUlucay/9c0de502ebc8e4af6b1c7e6036c9b971 to your computer and use it in GitHub Desktop.
c# snips
public static string StripNonNumeric(this string value)
{
var newVal = string.Empty;
foreach (var item in value)
{
var intVal = 0;
var res = int.TryParse(item.ToString(), out intVal);
if (res)
{
newVal += intVal.ToString();
}
}
return newVal;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment