Problem: I want to get only number from phone number Ex. 562-810-9631 or (562) 810 9631.
Solution: Use Regular expression
C#
var phoneNumber = Regex.Replace(phoneNumber, @"\D", String.Empty, RegexOptions.Compiled);
Every Programming Best Practice, Interview Question, Algorithms
Problem: I want to get only number from phone number Ex. 562-810-9631 or (562) 810 9631.
Solution: Use Regular expression
C#
var phoneNumber = Regex.Replace(phoneNumber, @"\D", String.Empty, RegexOptions.Compiled);
© Best Way to Code 2011 | Design by Blogger Hack Supported by PBT
0 comments:
Post a Comment