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 ...
随机推荐
- native为本地方法
在java中,native方法是指本地方法,当在方法中调用一些不是由java语言写的代码或者在方法中用java语言直接操纵计算机硬件时要声明为native方法. native方法的执行依赖于JVM的设 ...
- 【转】获取Sprite的实际Rect
判断点击是否点击在了一个精灵上, 其实就是判断一个点是否在一个矩形内. cocos2d-x的2.0.2版本可以使用CCRect的函数 bool CCRect::containsPoint(const ...
- linux 常用查找命令 小技巧
wc -l `find . -name "*.css"`|tail -n1 指定目录下 在指定后缀文件 查找关键字 find ./ -name "*" -exe ...
- Bootstrap--组件之按钮组
什么是按钮组呢?简单解释:就是把一堆的按钮放在一行或者一列中.下面来看一个实例. 按钮组嘛,首先是按钮,所以会用到.btn这个类,还有就是bootstrap提供的按钮组.btn-group这个类,所以 ...
- 移动端和PC端通用的三级导航菜单栏
免责声明: 本博客发布的所有信息资料都将尽可能注明出处.作者及日期,本人无意侵犯他人相关权益,如无意中侵犯了哪个媒体或个人的权益或知识产权,请留言或来信告之,本人将立即给予删除. Demo下载地址:h ...
- 百度编辑器1.4.3 .net版在vs2008的使用方法
由于在官方下载的ueditor包是在vs2012下开发的,可以在vs2010中使用,但在vs2008中就会报错.折腾了一翻,现将解决方法分享给需要的朋友,其实就是把里面包含.net4.0的元素换成.n ...
- 20151216JqueryUI学习笔记---按钮
按钮(button) , 可以给生硬的原生按钮或者文本提供更多丰富多彩的外观. 它不单单可以设置按钮或文本,还可以设置单选按钮和多选按钮.一. 使用 button 按钮使用 button 按钮 UI ...
- 转载---SQL Server XML基础学习<2>之--FOR XML AUTO/RAW
本文主要介绍FOR XML 的 AUTO 模式和 RAW 模式 --AUTO 模式将查询结果以嵌套 XML 元素的方式返回.这不能较好地控制从查询结果生成的 XML 的形式. --如果要生成简单的层次 ...
- SQL Server调优系列基础篇 - 并行运算总结(二)
前言 上一篇文章我们介绍了查看查询计划的并行运行方式. 本篇我们接着分析SQL Server的并行运算. 闲言少叙,直接进入本篇的正题. 技术准备 同前几篇一样,基于SQL Server2008R2版 ...
- apparmor介绍
AppArmor AppArmor 类似于selinux ,主要的作用是设置某个可执行程序的访问控制权限,主要区别就在于apparmor是以路径(path)为基础,而selinux以i节点(inode ...