sorting question

J. Landman Gay jacque at hyperactivesw.com
Tue Jun 23 23:38:20 EDT 2009


Paul Gabel wrote:
> Hello:
> 
> Is it possible to sort characters in a field "by chars," not by item or 
> line? That is, turn a field containing "cba" into "abc" using the sort 
> (container) command. The docs don't make it seem possible.

Not directly, but using Craig's suggestion, you can do something like this:

function charSort pWord
    repeat for each char c in pWord
       put c & cr after temp
    end repeat
    sort lines of temp
    replace cr with empty in temp
    return temp
end charSort

It's fast.

-- 
Jacqueline Landman Gay         |     jacque at hyperactivesw.com
HyperActive Software           |     http://www.hyperactivesw.com



More information about the use-livecode mailing list