Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我不知道如何制作从 11AA 到 99ZZ 的数组。是否可以在 Ruby 中做到这一点?
我想要这个数组:
['11AA', '11AB', '11AC',..., '99ZX', '99ZY', '99ZZ']
尝试以下操作:
('11AA'..'99ZZ').to_a
伪代码将是:
for i '1' to '9' for j '1' to '9' for k 'A' to 'Z' for l 'A' to 'Z' insert_in_array(i+j+k+l);
当然,这些值存储为字符串,用双“”不是“”。这是一个伪代码,它可以应用于任何编程语言。