Technological journey's of a lonely African Programmer
In: Ruby on Rails
6 Feb 2010There is practically nothing that cant be done with ruby (hmm… may be a little exaggerating there). Was working on this SMS platform where users can send SMS free without login or registration. The number was to be in the format eg. 233244342123, everything was smooth, i validated for digits on and the users are allowed to SMS up to 10 numbers in a single shot, which means you can do something like 233244566778,233244566777,233244566756 and it will be sent to three recipients.
I wanted to try some random numbers, so I shot up Address book on my Mac and copied a number, i realized it was in the format 233-244-124-660 and I always have to manually cleanup the dashes b4 I sent it. I knew this is going to be a usability issue and that’s not so good, looking at my level.
Well I decided to do a code improvement which will clear any empty spaces, dashes and plus symbols and then return the string as an array of numbers for further checks like restrict the user to 10 numbers only, etc.
Works perfectly like I want it to
Just tackling programming nightmares with flares. Sometimes the tactics are smooth sometimes their rough.