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.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

General Questions /

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

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

ArrayList sort without case sensitivity


Go to End


3 Posts   1362 Views

Avatar
SnowB1

Community Member, 11 Posts

28 February 2014 at 7:24am

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

Forum Moderator, 5523 Posts

1 March 2014 at 11:25am

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

Community Member, 11 Posts

4 March 2014 at 2:19am

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.