From: Bill Kelly Date: 2010-01-05T14:54:03+09:00 Subject: Re: How to generate a collection? Nanyang Zhan wrote: > Given any four letter word, for example: "card" > Replace one to three letters with "~", > How can I get the result collection ( ["~ard", "c~rd", ..., "~~r~", > "~~~d"])? One idea: irb> 1.upto(14) {|i| printf("%04b\n", i)} 0001 0010 0011 0100 0101 0110 0111 1000 1001 1010 1011 1100 1101 1110 Regards, Bill