Skip to main content
October 3, 2007
Answered

Array.CASEINSENSITIVE with compareFunction?

  • October 3, 2007
  • 6 replies
  • 500 views
The following does not return a case insensitive result. Any ideas how to do so?


This topic has been closed for replies.
Correct answer
tolowercase! You have many nuggets of AS knowledge kglad!

I was just browsing Flexs util classes such as StringUtil, ArrayUtil, and feeling abit envious!

6 replies

kglad
Community Expert
Community Expert
October 6, 2007
you're welcome.
Correct answer
October 6, 2007
tolowercase! You have many nuggets of AS knowledge kglad!

I was just browsing Flexs util classes such as StringUtil, ArrayUtil, and feeling abit envious!
kglad
Community Expert
Community Expert
October 5, 2007
if you're using a custom compare function, don't use the sort options. code your "option" in your custom sort function.
October 5, 2007
Try the Array.sortOn() method. It was designed for this very purpose, and it saves you the trouble of writing a custom sort function:

arr.sortOn('search', Array.CASEINSENSITIVE);
October 5, 2007
Thanks Francis.

Is there a way to sortOn properties of array members? For instance, will the attached code work in any syntactical way?
October 5, 2007
I don't think there is, so I'm building off of the following:

kglad: I don't know how to evaluate Strings as case-insensitive...is there an operator for such?
October 5, 2007
No it's not, the result isn't a case insensitive sort.

the trace should look like:

AlphaMale
lowercase
Cheeseburger
Socrates
zelda
Zelda
Inspiring
October 4, 2007
This code will running fine...