Jump to:

23368 Posts in 18143 Topics by 2863 members

General Questions

SilverStripe Forums » General Questions » ArrayList sort without case sensitivity

General questions about getting started with SilverStripe that don't fit in any of the categories above.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

Page: 1
Go to End
Author Topic: 224 Views
  • SnowB1
    Avatar
    Community Member
    9 Posts

    ArrayList sort without case sensitivity Link to this post

    I have an ArrayList that I am looking to sort on a field. I am doing

    $arrayList->sort('Title');

    which works except for the fact that it sorts based on case sensitivity. I would like it to be like
    • Example1
    • example2
    • Last

    instead of

    • Example1
    • Last
    • example2

  • Willr
    Avatar
    Forum Moderator
    5489 Posts

    Re: ArrayList sort without case sensitivity Link to this post

    Strange! I would have thought it would be case insensitive. You could simply export the array list as an array ($list->map()) then write your own sort logic.

  • SnowB1
    Avatar
    Community Member
    9 Posts

    Re: ArrayList sort without case sensitivity Link to this post

    Thanks Willr! I kinda wondered if that isn't what I was going to have to do. I couldn't believe it was case sensitive either. I didn't see any reason it should have been.

    224 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.