PC SOFT

ONLINE HELP
FOR WINDEV, WEBDEV AND WINDEV MOBILE

Home | Sign in | English US
  • Effect of the function ListSort
  • Comparing the numeric values
  • Characters taken into account for the punctuation and the spaces
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadApple WatchUniversal Windows 10 AppWindows Mobile
Others
Stored procedures
Sorts the elements found in a memory List Box, ListView or Combo Box control. This function has no effect on the browsing List Box, ListView and Combo Box controls.
Note: This function is useless if the control was declared as "Sorted" in the description window of control ("Details" tab).
Versions 16 and later
WINDEVLinux This function is now available for the WINDEV applications in Linux.
New in version 16
WINDEVLinux This function is now available for the WINDEV applications in Linux.
WINDEVLinux This function is now available for the WINDEV applications in Linux.
Versions 17 and later
iPhone/iPad This function is now available for the iPhone/iPad applications.
New in version 17
iPhone/iPad This function is now available for the iPhone/iPad applications.
iPhone/iPad This function is now available for the iPhone/iPad applications.
Versions 18 and later
Universal Windows 10 App This function is now available in Windows Store apps mode.
New in version 18
Universal Windows 10 App This function is now available in Windows Store apps mode.
Universal Windows 10 App This function is now available in Windows Store apps mode.
Versions 21 and later
Universal Windows 10 App This function is now available in Universal Windows 10 App mode.
New in version 21
Universal Windows 10 App This function is now available in Universal Windows 10 App mode.
Universal Windows 10 App This function is now available in Universal Windows 10 App mode.
Example
// Sorts the List Box control in lexicographical order
ListSort(LIST_Customer, True, ccLexicographicOrder)
Syntax
ListSort(<List Box Control> [, <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:
ccLexicographicOrderSort the character strings in lexicographical order (for example, the 'é' character is found between the 'e' and 'f' characters).
ccNormalSort while performing a standard comparison, similar to the = operator =.
ccRespectNumericSort while taking into account the numeric values inside the strings (in this case, "10" comes after "9").
ccIgnoreAccentSort while ignoring the accented characters
ccIgnoreCaseSort while ignoring the case (uppercase/lowercase characters).
ccIgnoreSpaceSort while ignoring the space characters found before and after the character strings.
ccIgnorePunctuationAndSpaceSort while ignoring the punctuation and the space characters (see the Notes for more details)
sortDefault
(default value)
Sort while ignoring the case and the accented characters and while taking the space characters into account.
sortWithoutFunctionGxxxSort while ignoring the elements such as gImage, gLink, ... By default, these elements are taken into account by the sort.
Remarks

Effect of the function ListSort

ListSort has a one-off effect: the elements added to the List Box or to the Combo Box control once ListSort has been used will comply with the sort options defined in the description window of control.

Comparing the numeric values

The ccRespectNumeric constant performs the sort by taking into account the numeric value represented by digits and not just the alphabetical order of 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 constantSorting strings containing digits with the ccRespectNumeric constant
000
000
001001
00901
011
010009
0909
19
10010
1110
911
Sorting strings containing digits without the ccRespectNumeric constantSorting strings containing digits with the ccRespectNumeric constant
10.00Aa7.00Aa
10.01Gh7.01Ba
10.50Ag7.01Dfe
11.00Aa7.50Fg
7.00Aa7.51Tga
7.01Ba8.00Aa
7.01Dfe8.01Gjk
7.50Fg8.01Ty
7.51Tga8.50Ze
8.00Aa9.00Aa
8.01Gjk9.80Er
8.01Ty9.99Zaaa
8.50Ze10.00Aa
9.00Aa10.01Gh
9.80Er10.50Ag
9.99Zaaa11.00Aa

Characters taken into account for the punctuation and the spaces

The characters taken into account for the punctuation and the spaces are supplied 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), ccIgnorePonctuationAndSpace) THEN
 s += Charact(i)
END
END
Info(s)
ToClipboard(s)
Components
WINDEVReports and Queries wd230obj.dll
WEBDEV - Server code wd230page.dll
Windows Mobile wp230obj.dll
Linux wd230obj.so
Minimum required version
  • Version 12
This page is also available for…
Comments
Exemplo ListSort
ListSort(LIST_List)

ListSort(LSV_Listview)

// Blog com Video e Exemplo

http://windevdesenvolvimento.blogspot.com.br/2016/11/aula-964-curso-windev-listbox-009.html

https://www.youtube.com/watch?v=J-QsqU3GEJA
De matos
Dec. 04 2016
Exemplo Combox Ordem
ListDeleteAll(COMBO_cliente)
FOR EACH cliente
ListAdd(COMBO_cliente,cliente.nome)
END
//Coloca em Ordem
ListSort(COMBO_cliente,True,ccLexicographicOrder)

//Frances
ListeSupprimeTout(COMBO_cliente)
POUR TOUT cliente
ListeAjoute(COMBO_cliente,cliente.nome)
FIN
//Coloca em Ordem
ListeTrie(COMBO_cliente,Vrai,ccOrdreLexicographique)

//Blog com Video e Exemplo
http://windevdesenvolvimento.blogspot.com.br/2016/03/curso-windev-combox-004-combox-ordemsort.html
De matos AMARILDO
Mar. 24 2016