目 录CONTENT

文章目录

Objective-C 格式化说明符

ABin
2022-10-09 / 0 评论 / 0 点赞 / 28 阅读 / 0 字

id 类型格式化说明符 %p

NSString %@

NSString *s = @"1234";
NSLog(@"String:%@",s);

int %d

int i = 1234;
NSLog(@"int:%d",i);

long %ld

long l = 1000000000000L;
NSLog(@"%ld",l);

long long %lld

long long ll =1000000000000L;
NSLog(@"%lld",ll);

float %f

float f = 123.23f;
NSLog(@"float:%f",f);

double %f %e %g

double d = 1.23;
NSLog(@"double:%f",d);

char %c

char c = 'z';
NSLog(@"Char:%c",c);
NSLog(@"ASCII:%d",c);

//占用的字节数量
NSLog(@"sizeOf:%ld",sizeof(c));

bool %d

bool b = true;
NSLog(@"boolean:%d",b);
0

评论区