String Format Specifiers
作者:
Dayon | 来源:发表于
2018-06-21 14:53 被阅读0次
https://developer.apple.com/library/archive/documentation/Cocoa/Conceptual/Strings/Articles/formatSpecifiers.html
Type |
Format specifier |
Considerations |
NSString |
%@ |
Objective-C object, printed as the string returned by descriptionWithLocale: if available, or description otherwise. Also works with CFTypeRef objects, returning the result of the CFCopyDescription function. |
int |
%d, %D |
Signed 32-bit integer (int). |
(unsigned int |
%u, %U |
Unsigned 32-bit integer (unsigned int). |
double |
%f |
64-bit floating-point number (double). |
(unsigned int |
%u, %U |
Unsigned 32-bit integer (unsigned int). |
NSInteger |
%ld or %lx |
Cast the value to long. |
NSUInteger |
%lu or %lx |
Cast the value to unsigned long. |
CGFloat |
%f or %g |
%f works for floats and doubles when formatting; but note the technique described below for scanning. |
CFIndex |
%ld or %lx |
The same as NSInteger. |
pointer |
%p or %zx |
%p adds 0x to the beginning of the output. If you don't want that, use %zx and no typecast. |
相关链接:
NSlog警告—— 编译器打印NSInteger类型
本文标题:String Format Specifiers
本文链接:https://www.haomeiwen.com/subject/dcnqyftx.html
网友评论