Objective-c格式化输出格式:

%@

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

Signed 32-bit integer (int).

%u%U

Unsigned 32-bit integer (unsigned int).

%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.

%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. Because the %s specifier causes the characters to be interpreted in the system default encoding, the results can be variable, especially with right-to-left languages. For example, with RTL, %s inserts direction markers when the characters are not strongly directional. For this reason, it’s best to avoid %s and specify encodings explicitly.

%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.

%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.

h

Length modifier specifying that a following doux, or X conversion specifier applies to ashort or unsigned short argument.

hh

Length modifier specifying that a following doux, or X conversion specifier applies to asigned char or unsigned char argument.

l

Length modifier specifying that a following doux, or X conversion specifier applies to along or unsigned long argument.

llq

Length modifiers specifying that a following doux, or X conversion specifier applies to along long or unsigned long long argument.

L

Length modifier specifying that a following aAeEfFg, or G conversion specifier applies to a long double argument.

z

Length modifier specifying that a following doux, or X conversion specifier applies to asize_t or the corresponding signed integer type argument.

t

Length modifier specifying that a following doux, or X conversion specifier applies to aptrdiff_t or the corresponding unsigned integer type argument.

j

Length modifier specifying that a following doux, or X conversion specifier applies to aintmax_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 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.

摘自Programming Guide for Cocoa文档

Objective-c格式化输出格式相关推荐

  1. python使用什么注释语句和运算-Python基础之注释,算数运算符,变量,输入和格式化输出...

    Python的注释 注释的作用:用自己熟悉的语言,对某些代码进行标注说明,增强程序的可读性: 在python解释器解释代码的过程中,凡是#右边的,解释器都直接跳过这一行: 注释的分类 单行注释 # 这 ...

  2. python输出格式控制_Python3.x那些事儿:[50]多种多样的输出格式

    目前有两种方式来格式化输出格式,第一种就是自己动手来进行字符串的操作,虽然麻烦,但是都能实现.第二种方式就是使用str.format()函数. string模块包含了一个Template类,这个类提供 ...

  3. 第3.8节 Python百分号占位符的字符串格式化方法

    一.    概念         格式化字符串就是将一些变量转换为字符串并按一定格式输出字符串,包括指定字符的位置.对齐方式.空位补充方式等.Python提供了多种字符串格式设置方法.本节先介绍一种简 ...

  4. SAS小白入门第二节:SAS数据类型和格式化(输入和输出)

    数据类型 在其他编程语言中,有各种各样的数据类型,但是总体上,可大致分为:数值型,字符型和日期型,而SAS中的数据类型,只有2中数据类型:字符型和数值型.在这里,你会发现,日期型的去哪了?在SAS程序 ...

  5. python重量转换_Python基础之注释,算数运算符,变量,输入和格式化输出

    Python的注释 注释的作用:用自己熟悉的语言,对某些代码进行标注说明,增强程序的可读性: 在python解释器解释代码的过程中,凡是#右边的,解释器都直接跳过这一行: 注释的分类 单行注释 # 这 ...

  6. Objective-C

    OC介绍 文章目录 前言 一.OC是什么? 二.第一段OC代码 三.OC基本介绍 前言 Objective-C是一种面向对象的C语言,本质还是C语言,兼容C和C++ ​​​​​​​     简称:OC ...

  7. 那些年一起学习的PHP(三)

    认识过PHP的变量以后就要懂得使用规则,定义方式,输出方式,存储方式才可以利用变量,下面就来认识: 一:PHP数据的输出 PHP支持的丰富的数据类型.后来在学习中会反复使用,有其他语言的学习知识,比较 ...

  8. 第一章 TensorFlow基础——python语法(二)

    简明Python基础(二) 此为jupyter notebook导出文档,如果习惯jupyter界面可以下载文件 链接:https://pan.xunlei.com/s/VMn5sAsjVypJElz ...

  9. iOS学习笔记37 时间和日期计算

    ###一.时间和日期计算 我们在应用开发中,时常需要和时间打交道,比如获取当前时间,获取两个时间点相隔的时间等等,在iOS开发中与时间相关的类有如下几个: NSDate:表示一个绝对的时间点 NSTi ...

最新文章

  1. vue绑定数据之前 会看到源代码
  2. 网站优化关键词如何分类看好这四种!
  3. 如何保存Tensorflow中的Tensor参数,保存训练中的中间参数,存储卷积层的数据
  4. 现金流量表的编制公式
  5. php程序时间数字,php – 给数字发短信的时间
  6. 碧蓝航线8.20服务器维护,《碧蓝航线》8月20日更新维护公告
  7. C# asp.net常见编译|运行错误
  8. python 3.5 format_python 3.5学习笔记(第四章)
  9. mysql has gone away 自动连接_MySQL-出现 MySQL server has gone away 原因和解决方法
  10. ML for trading -cs7646-04
  11. 2015第35周六转相见恨晚的知识列表
  12. C语言打印打印ASCLL表
  13. duilib开发(七):复杂控件介绍
  14. ecshop二次开发笔记
  15. Java基础13:反射详解
  16. linux 查看tps命令,Linux系统一些系统查看指令
  17. 公共基础知识中计算机知识,公共基础知识之计算机知识总结
  18. 什么是4k视频分辨率
  19. svn如何修改443端口
  20. 玩转Elasticsearch routing功能

热门文章

  1. oracle函数 INITCAP(c1)
  2. 小组会谈(2019.3.14)
  3. 数据结构开发(3):线性表的顺序存储结构
  4. 第七章:集成学习(利用AdaBoost元算法...)
  5. bzoj 1731: [Usaco2005 dec]Layout 排队布局【差分约束】
  6. 算法训练 Pollution Solution(计算几何)
  7. Openfire on Centos7
  8. 在win8下安装使用java及在win8下部署java环境变量-图文
  9. ip, tcp, udp, icmp header
  10. 物理拓扑和逻辑拓扑——现实和应用的比较