Skip to content

Instantly share code, notes, and snippets.

@C4Code
Created October 1, 2012 21:06
Show Gist options
  • Save C4Code/3814419 to your computer and use it in GitHub Desktop.
Save C4Code/3814419 to your computer and use it in GitHub Desktop.
NSNumbers and NSStrings
//
// C4WorkSpace.m
// numbersStrings
//
// Created by moi on 12-10-01.
// Copyright (c) 2012 moi. All rights reserved.
//
#import "C4WorkSpace.h"
@implementation C4WorkSpace
-(void)setup {
NSString *s = [NSString stringWithFormat:@"%d",1];
C4Log(@"%@",s);
s = [s stringByAppendingFormat:@"%d",2];
C4Log(@"%@",s);
NSNumber *n = [NSNumber numberWithInt:3];
C4Log(@"%@",n);
C4Log(@"%d",[n intValue]);
C4Log(@"%4.2f",[n floatValue]);
NSString *s2 = [n stringValue];
C4Log(@"%@",s2);
}
@end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment