NSArray 排序示例
NSArray Sorting Examples
请任何人帮我找出包含学生姓名的数组的排序元素,例如:
NSArray *studentsNames=@[@"bill", @"rob", @"ady",@"jhon", @"robert", @"prince"];
NSArray
中的所有排序函数如下所示:
sortedArrayHint
sortedArrayUsingFunction:context
sortedArrayUsingFunction:context:hint
sortedArrayUsingDescriptors
sortedArrayUsingSelector
sortedArrayUsingComparator
sortedArrayWithOptions:usingComparator
请给我适当的例子或link。
您可以按照以下方式对 NSArray 进行排序
studentsNames = [anArray sortedArrayUsingSelector:@selector(localizedCaseInsensitiveCompare:)];
希望对您有所帮助。
请任何人帮我找出包含学生姓名的数组的排序元素,例如:
NSArray *studentsNames=@[@"bill", @"rob", @"ady",@"jhon", @"robert", @"prince"];
NSArray
中的所有排序函数如下所示:
sortedArrayHint
sortedArrayUsingFunction:context
sortedArrayUsingFunction:context:hint
sortedArrayUsingDescriptors
sortedArrayUsingSelector
sortedArrayUsingComparator
sortedArrayWithOptions:usingComparator
请给我适当的例子或link。
您可以按照以下方式对 NSArray 进行排序
studentsNames = [anArray sortedArrayUsingSelector:@selector(localizedCaseInsensitiveCompare:)];
希望对您有所帮助。