Blocks Programming Topics
1.2 Block
block
inline block qsort_b
qsort_b qsort_r block
char *myCharacters[3] = { "TomJohn", "George", "Charles Condomine" };
qsort_b(myCharacters, 3, sizeof(char *), ^(const void *l, const void *r) {
char *left = *(char **)l;
char *right = *(char **)r;
return strncmp(left, right, 1) ;
});
// myCharacters is now { "Charles Condomine", "George", "TomJohn" }
1.3 CocoaBlocks
Cocoaframeworks block
NSArray sortedArrayUsingComparator block
block block NSComparator
NSArray *stringsArray = [NSArray arrayWithObjects:
@"string 1",
@"String 21",
@"string 12",
@"String 11",
@"String 02", nil];
static NSStringCompareOptions comparisonOptions = NSCaseInsensitiveSearch | NSNumericSearch
|
NSWidthInsensitiveSearch | NSForcedOrderingSearch;
NSLocale *currentLocale = [NSLocale currentLocale];