In pseudocode: function f(sofar, more) { array strings foreach letter in more { strings = f(foreach+letter, more-letter) } return strings }
HTH. --Ben Doom Greg Morphis wrote: > anyone else? I was hoping to do this in CF alone? > > Thanks > > On Wed, Feb 13, 2008 at 6:59 PM, Dawson, Michael <[EMAIL PROTECTED]> wrote: >> Thinking outside the box... You could use a database for this. Create a >> table that contains a single column. That column contains a record for each >> letter of the alphabet. Then, do a cartesian join to join that table to >> itself, three other times. Concatenate the fields and you should have each >> combination. >> >> That would get the first part without consideration of the second part. >> >> m!ke >> >> _____ >> >> From: Greg Morphis [mailto:[EMAIL PROTECTED] >> Sent: Wed 2/13/2008 4:57 PM >> To: CF-Talk >> Subject: all possible letter combinations >> >> >> >> >> Given a string, e.g. "ABCD" >> >> I need to come up with all combinations of letters >> eg >> ABCD >> ABDC >> ACBD >> ACDB >> ..... >> >> And exlude strings like 'AAAA', 'AAAB' unless you pass a string with >> duplicate characters >> If I pass the string "AAAB" then it'd return: >> AAAB >> AABA >> ABAA >> BAAA >> >> >> >> >> > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;160198600;22374440;w Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:298992 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4