String Format Specifiers

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)