381Zero-Padding in Objective-C
The age-old problem. Files, that are stored with padded zeros 000, 001, 002, 003 - and a counter that doesn't have this zero-padding. There are probably myriad solution to that problem, here's my take:
Create a temporary string consisting of a minimum of 3 characters length.
NSString *tempZeros = [NSString stringWithFormat:@"00%i", i];
Get the last 3 characters, shave off the rest.
NSString *zeroPaddedIndex = [tempZeros substringFromIndex:[tempZeros length] - 3];
No if's, no but's, no clauses.
Update: Of course, there's always a better way. 452