NSString by removing the initial zeros?
cocoa-touch, nsstring, objective-c
Solution
For smaller numbers:
NSString *str = @"000123";
NSString *clean = [NSString stringWithFormat:@"%d", [str intValue]];
For numbers exceeding int32 range:
NSString *str = @"100004378121454";
NSString *clean = [NSString stringWithFormat:@"%d", [str longLongValue]];
Problem
How can I remove leading zeros from an `NSString`? e.g. I have: `NSString *myString;` with values such as `@"0002060"`, `@"00236"` and `@"21456"`. I want to remove any leading zeros if they occur: e.g. Convert the previous to `@"2060"`, `@"236"` and `@"21456"`. Thanks.