NSLog输出格式

来源:互联网 发布:mac消音软件 编辑:程序博客网 时间:2024/06/08 14:08

%@        Object              

%d, %i    signed int 

%u          unsigned int

%f           float/double          %.2f float/double  保留两位小数

%x, %X   hexadecimal int         %x02 表示不足两位前面补足两位

%o           octal int 

%zu         size_t

%p           pointer

%e           float/double (in scientific notation)

%g           float/double (as %f or %e, depending onvalue)

%s           C string (bytes)

%S          C string (unichar)

%.*s        Pascal string (requires two arguments,pass pstr[0] as the first, pstr+1 as the second)

%c           character

%C          unichar 

%lld         long long

%llu         unsigned long long

%Lf         long double

%ld       long

这里有苹果官方的说明

https://developer.apple.com/library/mac/documentation/Cocoa/Conceptual/Strings/Articles/formatSpecifiers.html#//apple_ref/doc/uid/TP40004265

0 0
原创粉丝点击