Created
February 16, 2011 15:08
-
-
Save Electron-libre/829522 to your computer and use it in GitHub Desktop.
to get ["1", "12", "123", "1234", "12345", "123456", "1234567", "12345678", "123456789", "1234567890"] with "123456789"
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
destination_number = cdr.called_number | |
prefixes_array = Array.new | |
destination_number.each_char do |char| | |
prefixes_array << (destination_number[-1] or '' ) + char | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment