Created
August 25, 2016 13:21
-
-
Save ronsims2/8566b184525c176e95db9a8666d25ff7 to your computer and use it in GitHub Desktop.
Example of how to left pad in Objective-C
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// main.m | |
// testcode | |
// | |
// Created by Ron Sims II on 6/6/16. | |
// Copyright © 2016 Ron Sims II. All rights reserved. | |
// | |
#import <Foundation/Foundation.h> | |
int main(int argc, const char * argv[]) { | |
@autoreleasepool { | |
// insert code here... | |
NSInteger foo = 142; | |
NSString *formattedFoo = [NSString stringWithFormat:[NSString stringWithFormat:@"STJ%%0%ddT1", 4], foo]; | |
NSLog(@"Store Number: %@", formattedFoo); | |
} | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment