Phone numbers in Twilio’s API need to be formatted like this: +xxxxxxxxxx
In code this can be difficult to read and easy to make a mistake with. With Ruby you can run code against a constant string before it gets constantized (“pre-processing”):
NUMBER = '+1 (777) 239-3636'.gsub(/[^0-9+]/, '') puts NUMBER #=> +17772393636Now you can read a value in code, and clean it of extra characters before using it.