|
|
|
|
|
- Effect of <List Box>.Sort
- Comparing numeric values
- Characters taken into account for punctuation and spaces
<List Box>.Sort (Function) In french: <Liste>.Trie Sorts the elements in a List Box, ListView or Combo Box control populated programmatically. This function has no effect on the browsing List Box, ListView and Combo Box controls. Remark: This function is useless if the control was declared as "Sorted" in the control description window ("Details" tab).
// Sorts the List Box control in lexicographical order LIST_Customer.Sort(True, ccLexicographicOrder)
Syntax
<List Box control>.Sort([<Sort order> [, <Sort options>]])
<List Box control>: Control name Name of List Box or Combo Box control to sort. <Sort order>: Optional boolean - True (by default) to perform a sort in ascending order,
- False to perform a sort in descending order.
<Sort options>: Optional constant (or combination of constants) Sort options selected for the content of List Box (or Combo Box) control: | | ccIgnoreAccent | Sorts text while ignoring accents | ccIgnoreCase | Sort while ignoring the case (uppercase/lowercase characters). | ccIgnorePunctuationAndSpace | Sorts text while ignoring punctuation and spaces (for more details, see the Remarks) | ccIgnoreSpace | Sort while ignoring the space characters found before and after the character strings. | ccLexicographicOrder | Sorts the strings in lexicographical order (for example, 'é' is between 'e' and 'f). | ccNormal | Sort while performing a standard comparison, similar to the = operator =. | ccRespectNumeric | Sort while taking into account the numeric values inside the strings (in this case, "10" comes after "9"). | sortDefault (default value) | Performs a case-insensitive and accent-insensitive sort. Ignores spaces. | sortWithoutFunctionGxxx | Sorts text while ignoring gImage, gStoredValue, etc., ... By default, these elements are taken into account by the sort. |
Remarks Effect of <List Box>.Sort <List Box>.Sort will have an effect at a specific moment: after calling <List Box>.Sort, elements will be added to the List Box or Combo Box control according to the sort options defined in the control description window. Comparing numeric values The ccRespectNumeric constant sorts by taking into account the numeric value represented by digits and not just the alphabetical order of the numbers. Without the ccRespectNumeric constant, the strings below will be sorted in the following order: "string1", "string10", "string2" With the ccRespectNumeric constant, the same strings will be sorted in this order: "string1", "string2", "string10" Lets' see some examples of comparison performed with and without the ccRespectNumeric constant: | | Sorting strings containing digits without the ccRespectNumeric constant | Sorting strings containing digits with the ccRespectNumeric constant | 0 | 00 | 00 | 0 | 001 | 001 | 009 | 01 | 01 | 1 | 010 | 009 | 09 | 09 | 1 | 9 | 10 | 010 | 11 | 10 | 9 | 11 |
| | Sorting strings containing digits without the ccRespectNumeric constant | Sorting strings containing digits with the ccRespectNumeric constant | 10.00Aa | 7.00Aa | 10.01Gh | 7.01Ba | 10.50Ag | 7.01Dfe | 11.00Aa | 7.50Fg | 7.00Aa | 7.51Tga | 7.01Ba | 8.00Aa | 7.01Dfe | 8.01Gjk | 7.50Fg | 8.01Ty | 7.51Tga | 8.50Ze | 8.00Aa | 9.00Aa | 8.01Gjk | 9.80Er | 8.01Ty | 9.99Zaaa | 8.50Ze | 10.00Aa | 9.00Aa | 10.01Gh | 9.80Er | 10.50Ag | 9.99Zaaa | 11.00Aa |
Characters taken into account for punctuation and spaces The characters taken into account for punctuation and spaces are provided by the system. To get the list of these characters, write the following WLanguage code:
s is string FOR i = 0 TO 255 IF Charact(i) <> StringFormat(Charact(i), ccIgnorePunctuationAndSpace) THEN Â s += Charact(i) END END Info(s) ToClipboard(s)
This page is also available for…
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|