CValueSet:SortKey
The SortKey method lists the contents of the CValueSet as (string key, value) pairs by sorting on the string key.
CValueSet:SortKey()
The sorting results may be confusing because string sorting uses standard rules based on the decimal values of the ASCII character set. For example, "my key F" sorts to a lower set index than "my key c". This happens because the "F" character has ASCII decimal value 70 whereas "c" has ASCII decimal value 99. For details, see the ASCII character set on the Web..
The following example creates a CValueSet S and sorts its members by the string keys:
|
-- constructor, set to values of type "number" |
|
-- add a key and value at index 1 |
|
-- add a key and value at index 2 |
|
-- add a key and value at index 3 |
|
|
|
-- sort set members by their string key |
|
|
Below is the result of the previous script as listed in a CTextView window:
Before SortKey:
key_9 -1.4
key_2 107.23
key_3 78.6
After SortKey:
key_2 107.23
key_3 78.6
key_9 -1.4
CValueSet Class, Add, List, Sort
Mira Pro x64 Script User's Guide, v.8.73 Copyright Ⓒ 2024
Mirametrics, Inc. All Rights Reserved.