What's the easiest way to format a string based on another input string that uses hash symbols, minus, and spaces.
What I have is one string that contains a phone number that might look like this (or has multiple spaces in it):
012-34567890
I have another string that contains the format that the number has to be converted to, this looks like this:
### - ## ## ##
or
## - ### ## ##
or
###-## ## ##
The hash positions must be leading for the formatting of the numbers. I can't seem to think of something that does this...
In some cases (like for international phone numbers) the (, ) and + symbols must be used. In that case the conversion string looks like this (for instance)
+(##)-(#)##-## ## ##
Anyone any ideas?