Created
September 20, 2018 07:02
-
-
Save DorukUlucay/9c0de502ebc8e4af6b1c7e6036c9b971 to your computer and use it in GitHub Desktop.
c# snips
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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