Skip to content

Instantly share code, notes, and snippets.

@inohiro
Created July 26, 2012 10:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save inohiro/3181321 to your computer and use it in GitHub Desktop.
Save inohiro/3181321 to your computer and use it in GitHub Desktop.
separate integer value for dimension table
def main( i )
i = i.to_s
a = []
i.size.times do |j|
str = i[j]
( i.size - j - 1 ).times do
str << '0'
end
a << str.to_i
end
a
end
require 'pp'
[ 123456, 12345678, 123456789 ].each do |i|
puts i
pp main( i )
puts
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment