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 ...
随机推荐
- 前端JS开发框架-DHTMLX--dhtmlXTree
介绍 dhtmlxTree是一个功能丰富的JavaScript树菜单 它允许您快速添加一个好看的,基于ajax的web页面的分层树. treeview支持在线节点编辑.先进的拖放,三态复选框等等.由 ...
- Free Editor
Mars Nov 19, 2014
- careercup-数学与概率 7.6
7.6 在二维平面上,有一些点,请找出经过点数最多的那条线. 解法: 类似于leetcode:Max Points on a Line 我们只需在任意两点之间“画”一条无限长的直线(也即不是线段),并 ...
- Qt树形控件QTreeView使用1——节点的添加删除操作 复选框的设置
QtreeView是ui中最常用的控件,Qt中QTreeWidget比QTreeView更简单,但没有QTreeView那么灵活(QTreeWidget封装的和MFC的CTreeCtrl很类似,没有m ...
- Lua开发环境搭建(Mac)
1.下载最新版的Lua,点击下载 2.下载完成后,解压压缩包,打开终端,cd进入Lua解压目录下 3. 在终端输入“make macosx”,编译lua 4.编译完成后,在终端输入”make test ...
- 如何在mysql命令窗口获取到程序正在执行的sql语句
步骤: 1.进入mysql的命令窗口: 2.运行use information_schema; 3.运行select * from PROCESSLIST where info is not null ...
- android activity启动的4种方式记录及打开其他应用的activity的坑
Android启动的四种方式分别为standard,singleTop,singleTask,singleInstence. standard是最常见的activity启动方式,也是默认的启动的方式. ...
- 实现一个脚本语言Raven(一)
之前实现了Raven语言的0.1版,仅仅支持表达式处理与控制语句,由于不支持数组.函数.类,甚至都不是图灵完全的语言. 现在参考vczh的博客打算重新写一遍Raven语言.陈祖不愧是神啊,高中就写出支 ...
- C++实现多线程类Thread
Windows编程中创建线程的常见函数有:CreateThread._beginthread._beginthreadex.据说在任何情况下_beginthreadex都是较好的选择. _begint ...
- (转)JSON基础入门
原文地址:http://kb.cnblogs.com/page/43982/ JSON 基础简单地说,JSON 可以将 JavaScript 对象中表示的一组数据转换为字符串,然后就可以在函数之间轻松 ...