Character sort

Yates, Glen JAMES.G.YATES at saic.com
Wed Apr 24 10:10:00 EDT 2002


Ok here's a shot at it:

  put "" into tempVariable
  put "" into outputVariable
  repeat for each char i in yourVariable
    put i & return after tempVariable
  end repeat
  sort lines of tempVariable
  repeat for each line i in tempVariable
    put i after outputVariable
  end repeat

I wrote this off the top of my head, maybe there's an easier way, but this
should work. Note: this does not change your original variable, but puts the
sorted data into a new variable "outputVariable". If you want your original
variable to be sorted and changed, then use the following code:

  put "" into tempVariable
  repeat for each char i in yourVariable
    put i & return after tempVariable
  end repeat
  sort lines of tempVariable
  put "" into yourVariable
  repeat for each line i in tempVariable
    put i after yourVariable
  end repeat

Hope this helps,
-Glen Yates

-----Original Message-----
From: Richard James [mailto:rjames at apple.com]
Sent: Wednesday, April 24, 2002 9:26 AM
To: use-revolution at lists.runrev.com
Subject: Character sort


Please help.

I need a quick way to ASCII sort the letters of a one word variable.

Thanks
Richard James 



More information about the use-livecode mailing list