title: NSSortDescriptor sort with number as string?
body: <p>Got a an Array full of dictionary likes this:</p>
  
  <pre><code>(
     { order = "10";
       name = "David"
     };
     { order = "30";
       name = "Jake";
     };
     { order = "200";
       name = "Michael";
     };
  )
  </code></pre>
  
  <p>When i'm using NSSortDescriptor like the code below it only sorts regarding to the first char so 200 is lower then 30. I can of course change the "order" object into a NSNumber instead of string and it would work. But is there a way to sort a string as int values without changing the source object?</p>
  
  <pre><code>NSSortDescriptor *descriptor = [[NSSortDescriptor alloc] initWithKey:@"norder"  ascending:YES];
  [departmentList sortUsingDescriptors:[NSArray arrayWithObjects:descriptor,nil]];
  </code></pre>
  
  <p><strong>Update:</strong></p>
  
  <p>Thanks to bandejapaisa.</p>
  
  <p>Here is the a working version for iOS 5 (Xcode where compalining).</p>
  
  <pre><code>NSArray *sortedArray;
  sortedArray = [departmentList sortedArrayUsingComparator:(NSComparator)^(id a, id b) {
      NSNumber *num1 = [NSNumber numberWithInt:[[a objectForKey:@"norder"] intValue]];
      NSNumber *num2 = [NSNumber numberWithInt:[[b objectForKey:@"norder"] intValue]];
  
      return [num1 compare:num2];
  }];
  departmentList = [sortedArray mutableCopy];
  </code></pre>