Tips and tricks for .NET using ASP and VB code.

Remove embedded dashes (and other non-digit characters) from a number

        Dim RemoveNonDigits As New Regex("[^\d]")
Dim StringWithNonDigits As String = "1-(800)-555-1212"
Dim StringWithJustDigits As String = RemoveNonDigits.Replace(StringWithNonDigits, "")

No comments:

Post a Comment

Search This Blog