December 2012
Intermediate to advanced
316 pages
6h 51m
English
In this recipe, we will see how special characters and blanks may be removed from a text string comprising of a telephone number. We will create a program that will take as input the number containing blank spaces and special characters such as +, (, and ).
The replace statement along with suitable regular expressions will be used. Various regular expressions may work in this case. We will see two such expressions in this recipe.
For meeting the mentioned requirement, proceed as follows:
number, consisting of 20 characters.replace all occurrences is added having the regular expression [^\d].The solution is based on searching all non-digit characters ...
Read now
Unlock full access