...
Unlike lexicographic sorting which compares the coding value of each character, this sort uses a collation which enables two character strings to be compared according to a given language.
NB:
Some differences in relation to the FreeMarker "built-in" "sort_by" function (click here for more details) applied to a ([?]?sort_by) sequence and the "lexicographicSortBy" function:
- The result obtained from the three "sort_by", "lexicographicSortBy" and "localeBasedSortBy" functions is identical for Boolean/Number/Date/Time/Date-time types. For the String type, the FreeMarker "sort_by" function applies a sort using a collation (so a result identical to "localBasedSortBy" but different from "lexicographicSortBy"),
- The "sort_by" function does not sort in descending order. The only solution is to use the FreeMarker "reverse" ([?]?sort_by()?reverse) function, but the original order of equal values is not respected.
Parameters
Hardis - Tableau personnalisé | ||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| ||||||||||||||||
|
...
For example
Pas de format |
---|
<#assign elegance = [ {"value": "Élégance"}, {"value": "Elegance"}, {"value": "elegance"} {"value": "élégance"}, {"value": "elegANCE"}, {"value": "elègance"} ]><#> <#-- Sorted by value --><#list> <#list hardisCode.localeBasedSortBy(elegance, 'value', {'locale': 'fr_FR', 'strength':'primary'}) as aObj> - ${aObj.value} </#list> ? |
...
The output is:
- Élégance
- Elegance
...
- élégance
- elegANCE
- elègance
Another example
Pas de format |
---|
<#assign elegance = [ {"value": "Élégance"}, {"value": "Elegance"}, {"value": "elegance"} {"value": "élégance"}, {"value": "elegANCE"}, {"value": "elègance"} ]><#> <#-- Sorted by value --><#list> <#list hardisCode.localeBasedSortBy(elegance, 'value', {'locale': 'fr_FR', 'strength':'tertiary'}) as aObj> - ${aObj.value} </#list> |
The output is:
- elegance
- elegANCE
...
- elègance
- élégance
- Élégance
Hardis - Haut de page |
---|
↑ Top of page |
...