Need a function that re-arranges words(!)

valetia at mac.com valetia at mac.com
Mon Nov 24 17:32:12 CST 2003


Hi all,

Help! :) I've been trying to figure this out but it's been a mess, even
though I think it's probably an easy one.

What I need is rev code that can do this:

Given any phrase, e.g.: "my fat cat"

Spit out all of the following (no need to be in this order):

my fat cat
my cat fat
fat my cat
fat cat my
cat my fat
cat fat my

myfat cat
my fatcat
myfatcat

mycat fat
my catfat
mycatfat

fatmy cat
fat mycat
fatmycat

fatcat my
fat catmy
fatcatmy

catmy fat
cat myfat
catmyfat

catfat my
cat fatmy
catfatmy


Conditions:

1. The input phrase can be *any* number of words (not just 3).

2. Each line of the results must contain all the words within (no missing
words).

Any takers? Thanks in advance! :)

Valetia





More information about the use-livecode mailing list