Sort so that "Hello" is always before "hello"

hh hh at hyperhh.de
Thu May 18 17:43:42 EDT 2017


> Kaveh B. wrote:
> I have the following lines when a list of words is sorted: Hello
> hello Hello hello hello so there is no hierarchy between upper and
> lower case chars. I want caps to go first. How do i do that pls? 

Let me explain a bit more.

You want a sort with co-sort. LC allows this because it's sort is stable:

The secondary sort or 'co-sort' has to be done before the sort. It sets the
sort order for the case that chunks in the following primary sort function.

Here are first all upper case chunks sorted before the lower case chunks.
Then, with casesensitive false, LC doesn't change the sort order for
chunks that are equal in the current sort function.

on mouseUp
  set the casesensitive to true -- secondary sort:
  sort myContainer
  set the casesensitive to false -- primary sort:
  sort myContainer
on mouseUp

For example

Hello
hello
hello
hallo
Hallo
Guest
guest
Guest

becomes

Guest
Guest
guest
Hallo
hallo
Hello
hello
hello





More information about the use-livecode mailing list