Skip to content

Instantly share code, notes, and snippets.

@Electron-libre
Created February 16, 2011 15:08
Show Gist options
  • Save Electron-libre/829522 to your computer and use it in GitHub Desktop.
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"
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