Zum Hauptinhalt gehen

sort a list ignoring capitals and german umlauts

Kommentare

5 Kommentare

  • Zendesk API User
    Author: Peter_Jodeleit - 7/8/2010 9:45

    Nice example how to use the template syntax :smileywink: (there a missing some hyphens).

    Another possibility is to use the java class java.text.Collator:

       $CMS_SET(list, ["Aachen", "Ende", "Zukunft", "anfang", "Ärger", "Österreich", "ähnlich"])$
       $CMS_SET(comperator, class("java.text.Collator").instance(#global.locale))$
       $CMS_VALUE(list.copy.sort(comperator).toString("<br>\n"))$
    0
  • Zendesk API User
    Author: Peter_Jodeleit - 7/8/2010 9:53

    To make the usage simpler you could define a sorter e.g. in the global project settings template:

      $CMS_SET(comperator, class("java.text.Collator").instance(#global.locale))$
      $CMS_SET(sort, x -> x.copy.sort(comperator))$

    Use it like this in all other templates:

       $CMS_VALUE(sort.eval(list).toString("<br/>\n"))$

    This way you can define your own library of useful template functions...

    0
  • Zendesk API User
    Author: hoebbel - 7/8/2010 9:54
    (there a missing some hyphens)

    Jive did eat them :smileywink:. After reformatting the text, they are now visible [do not use the XML format for java/FirstSpirit Code]

    0
  • Zendesk API User
    Author: sglock - 5/27/2011 16:03

    Adding "alphabetical" and "alphabetisch" might be a good idea since searching the community did not deliver this blog entry when looking for these keywords. Now it does. :-)

    0
  • Zendesk API User
    Author: TimoMeister - 12/9/2014 13:23

    How to sort this list language dependent with #global.locale?

    $CMS_SET(list, [{"city":"Bochum","id":323},{"city":"Aachen","id":123},{"city":"Ähhausen","id":274},{"city":"Ärgerdorf","id":242}])$

    Solution:

    https://community.e-spirit.com/message/23024#23024

    0

Bitte melden Sie sich an, um einen Kommentar zu hinterlassen.