Friday, December 19, 2008

Case insensitive SortCompare Function for Strings

Here is a quick post on how to use the sortCompare function to sort strings.

Here goes the sample.Assuming your dataField is called status.This sortcomparefunction will function insensitive to the case of the strings.

private function statusSortCompareFunction(obj1:Object,obj2:Object):int {

if (!obj1.hasOwnProperty("status")) {

obj1.status = null;


if (!obj2.hasOwnProperty("status")) {

obj2. status = null;


return ObjectUtil.stringCompare(obj1.status,obj2.status,true);


Hope it helps!

No comments: