Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

General Questions

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

ArrayList sort without case sensitivity


Reply

3 Posts   331 Views

Avatar
SnowB1

28 February 2014 at 7:24am Community Member, 9 Posts

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

Avatar
Willr

1 March 2014 at 11:25am Forum Moderator, 5511 Posts

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.

Avatar
SnowB1

4 March 2014 at 2:19am Community Member, 9 Posts

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.