OC中格式化输出符号
| 定义 | 说明 |
| %@ | 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. |
| %% | ‘%’ character |
| %d, %D, %i | Signed 32-bit integer (int) |
| %u, %U | Unsigned 32-bit integer (unsigned int) |
| %hi | Signed 16-bit integer (short) |
| %hu | Unsigned 16-bit integer (unsigned short) |
| %qi | Signed 64-bit integer (long long) |
| %qu | Unsigned 64-bit integer (unsigned long long) |
| %x | Unsigned 32-bit integer (unsigned int), printed in hexadecimal using the digits 0–9 and lowercase a–f |
| %X | Unsigned 32-bit integer (unsigned int), printed in hexadecimal using the digits 0–9 and uppercase A–F |
| %qx | Unsigned 64-bit integer (unsigned long long), printed in hexadecimal using the digits 0–9 and lowercase a–f |
| %qX | Unsigned 64-bit integer (unsigned long long), printed in hexadecimal using the digits 0–9 and uppercase A–F |
| %o, %O | Unsigned 32-bit integer (unsigned int), printed in octal |
| %f | 64-bit floating-point number (double) |
| %e | 64-bit floating-point number (double), printed in scientific notation using a lowercase e to introduce the exponent |
| %E | 64-bit floating-point number (double), printed in scientific notation using an uppercase E to introduce the exponent |
| %g | 64-bit floating-point number (double), printed in the style of %e if the exponent is less than –4 or greater than or equal to the precision, in the style of %f otherwise |
| %G | 64-bit floating-point number (double), printed in the style of %E if the exponent is less than –4 or greater than or equal to the precision, in the style of %f otherwise |
| %c | 8-bit unsigned character (unsigned char), printed by NSLog() as an ASCII character, or, if not an ASCII character, in the octal format \\ddd or the Unicode hexadecimal format \\udddd, where d is a digit |
| %C | 16-bit Unicode character (unichar), printed by NSLog() as an ASCII character, or, if not an ASCII character, in the octal format \\ddd or the Unicode hexadecimal format \\udddd, where d is a digit |
| %s | Null-terminated array of 8-bit unsigned characters. %s interprets its input in the system encoding rather than, for example, UTF-8. |
| %S | Null-terminated array of 16-bit Unicode characters |
| %p | Void pointer (void *), printed in hexadecimal with the digits 0–9 and lowercase a–f, with a leading 0x |
| %L | Length modifier specifying that a following a, A, e, E, f, F, g, or G conversion specifier applies to a long double argument |
| %a | 64-bit floating-point number (double), printed in scientific notation with a leading 0x and one hexadecimal digit before the decimal point using a lowercase p to introduce the exponent |
| %A | 64-bit floating-point number (double), printed in scientific notation with a leading 0X and one hexadecimal digit before the decimal point using a uppercase P to introduce the exponent |
| %F | 64-bit floating-point number (double), printed in decimal notation |
| %z | Length modifier specifying that a following d, i, o, u, x, or X conversion specifier applies to a size_t or the corresponding signed integer type argument |
| %t | Length modifier specifying that a following d, i, o, u, x, or X conversion specifier applies to a ptrdiff_t or the corresponding unsigned integer type argument |
| %j | Length modifier specifying that a following d, i, o, u, x, or X conversion specifier applies to a intmax_t or uintmax_t argument |
| 类型 | 定义 | 建议 |
| 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 see below warning when scanning |
| CFIndex | %ld or %lx | The same as NSInteger |
| pointer | %p | %p adds 0x to the beginning of the output. If you don’t want that, use %lx and cast to long. |
| long long | %lld or %llx | long long is 64-bit on both 32- and 64-bit platforms |
| unsigned long long | %llu or %llx | unsigned long long is 64-bit on both 32- and 64-bit platforms |
OC中格式化输出符号的更多相关文章
- iOS 格式化输出符号与类型转换
1.iOS 格式化输出符号 %@ 对象 %d, %i 整数 %u 无符号整形 %f 浮点(双字节) %x, %X 二进制整数 %o 八进制整数 %zi ...
- C语言中格式化输出的转换说明的fldwidth和precision解析
首先说什么是C语言的格式化输出,就是printf和它的几个变种(grep -E "v?(sn|s|f)printf").像这些函数都有一个参数format,format中可以加点转 ...
- printf 格式化输出符号详细说明(转)
%a 浮点数.十六进制数字和p-记数法(C99)%A 浮点数.十六进制数字和p-记法(C99)%c 一个字符(char) %C 一个ISO宽字符 %d 有符 ...
- 李洪强iOS开发之OC[002] - OC中注释以及@符号的使用
- MYSQL 、Oracle、SQLServer 数据库中时间的格式化输出
在MYSQL 中格式化输出 date_forma t(date,'yyyyMMddHHmmss') Oracle 中格式化输出 to_char(time ,'yyyyMMddHHmmss') SQL ...
- python中实现格式化输出 %用法
当我们在python中需要打印出特定格式的内容时可以用到这个方法,方法介绍如下: 例如我们现在要收集用户的一些个人信息,这时候我们的代码如下: name=input("name: " ...
- Python中格式化format()方法详解
Python中格式化format()方法详解 Python中格式化输出字符串使用format()函数, 字符串即类, 可以使用方法; Python是完全面向对象的语言, 任何东西都是对象; 字符串的参 ...
- C语言 printf格式化输出,参数详解
有关输出对齐 int main(int argc, char* argv[]){ char insertTime[20] = {"1234567890"}; double in ...
- python格式化输出及大量案例
python格式化输出符号及大量案例 1.格式化输出符号 python格式化输出符号 格式化符号 含义 %c 转化成字符 %r 优先使用repr()函数进行字符串转化 %s 转换成字符串,优先使用st ...
随机推荐
- ubuntu上如何安装和卸载google chrome 浏览器
切换到安装文件目录 $ sudo dpkg -i file_name.deb 如果有错误,请运行以下命令 $ sudo apt-get -f install or $ sudo apt-get ins ...
- C# - 系统类 - Array类
Array类 ns:System Array是一个抽象类 表示数组 提供了创建.查找.删除.排序.修改等应用于数组的操作 此类没有公有的实例构造函数 可以使用静态方法CreateInstance创建A ...
- 关于Xcode7中的tbd文件
tbd 是 text-based stub libraries的意思, 是苹果在Xcode7中使用的一个技术,便于减少Xcode7中SDK的体积. 下面讲解下Xcode7如何通过tbd这个技术减少SD ...
- Manually connecting to the Oracle Linux Yum Server
Manually connecting to the Oracle Linux Yum Server 1. Download and Install Oracle Linux Note: The ...
- css字体转换程序(Node.js)
我下载的是ttf文件,css导入的文件有多种格式:eot,woff,svg 在windows下,需要寻找相应的exe文件来处理或者node.js来处理: ttf2eot: https://github ...
- 关于MD5校验和java工程下的校验
File file = new File("cos_code2003.bin"); System.out.println(file.length()); byte[] data = ...
- zigbee
IEEE802.15.4定义了两种器件:全功能器件(FFD,Full-FunctionDevice),和简化功能器件(RFD,Reduced-functionDevice) 协调器:(coordina ...
- cognos 10.2.2 导入samples数据源报错解决
操作系统:windows 2008R2 X64 数据库:oracle 10.2.0.1 X32 sid:cognosdb86 安装完samples后,执行IBM安装目录webcontent\sampl ...
- mac最常用终端命令
1分钟,快速复习下: pwd (显示当前所在路径) ls -l (列出文件的详细信息,如创建者,创建时间,文件的读写权限列表等等) touch `filename`(创建文件) open `file ...
- c#中的重写方法与隐藏方
1.父类中有方法a,添加virtua修饰符可声明为虚方法,在子类中可以用override声明后重写方法a. 2.父类中有方法a,在子类中可以有new修饰符声明后隐藏父类方法. 子类重写方法后,对于子类 ...