Regular expression (getting number, C#)
Please help me to write Regular expression on C# for getting Int64 value from string:
"NumberLong("634461051992965873")"
my string inc开发者_StackOverflow中文版ludes NumberLong part;
so as result must be 634461051992965873
Thank you!)))
string Temp = "Hax00r L33t";
string Output = Regex.Replace(Temp, "[^0-9]", "");
long num = long.Parse(Output);
long.Parse("634461051992965873")
does the job, but you could check long.TryParse
too.
String txt = "634461051992965873";
int nbr;
if(Int64.TryParse(txt, out nbr)) {
// text can be converted to Integer
}
精彩评论