Objective-c格式化输出格式

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文档

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/500168.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

在计算机网络中发送电子邮件遵循的协议是,一、计算机网络刷题

connect函数返回错误ECONNREFUSED:如果对客户的SYN的响应是RST,则表明该服务器主机在我们指定的端口上没有进程在等待与之连接(例如服务器进程也许没有启动),这称为硬错(hard error),客户一接收到RST,马上就返回错误ECONNREFUSED.…

JSON特殊字符处理

1.json结构中使用的标示符:都为英文格式冒号 :双引号 ""大括号 {}方括号 []逗号 ,2.使用注意要确保在json的结构中,使用以上标准的标示符来构建结构。其中的键值串都由双引号引起来,键值串中不能包含双引号和转义字符。在键值…

常用Mac小命令

Lion显示资料库:chflags nohidden /Users/用户名/Library消除Dock隐藏延迟:defaults write com.apple.Dock autohide-delay -float 0 && killall Dock

iOS开发内存管理总结

一、retain、copy、assign的区别:1.retain:当对一个对象A调用retain,然后赋值给B时,对象的引用计数加1,A和B指向同一个内存地址。2.copy:当对一个对象A调用retain,然后赋值给B时,对象…

微型计算机的应用特点,微型计算机的特点及应用

微型计算机的特点及应用计算机基础知识,1.1 走进计算机世界 计算机的发展历史 微型计算机的特点及应用 1.2 计算机是如何工作的 计算机的硬件组成 计算机的软件系统 1.3 计算机外部设备 计算机的存储设备 输入输出设备 1.4 计算机安全规范,(2)按功能分类,按功能分类一般可分为专…

田野中科院计算机网络信息中心,中国科学院计算机网络信息中心硕士生导师田野...

姓名:田野性别:男职称:副研究员专家类别:副高级邮编:100190邮箱:tianyecnic.cn通讯地址:北京市海淀区中关村南四街4号简历:田野,男,1979年6月生,博…

扩展函数不能返回空值html,JavaScript程序设计-中国大学mooc-题库零氪

第1章 JavaScript初探JavaScript简介随堂测验1、JavaScript由哪三部分组成( )A、ECMAScriptB、BOMC、CSSD、DOMJavaScript相关应用随堂测验1、以下哪个选项是JavaScript技术特性?( )A、跨平台性B、解释型脚本语言C、基于对象的语言D、具有以上各种功能HBuilder的快速…

西安邮电大学计算机学院学生会,2017年度计算机学院教职工代表大会工作报告.doc...

PAGE \* MERGEFORMAT 51凝心聚力,开拓创新,以主人翁的工作态度共谋计算机学院新发展2017/2018学年计算机学院教代会学院工作报告王忠民各位代表:大家下午好!今天,我们在这里召开计算机学院教职工代表大会,回…

电子数字计算机最早应用于哪个领域,2013计算机一级B考试模拟试题及答案(2)...

无忧考网为大家收集整理了《2013计算机一级B考试模拟试题及答案(2)》供大家参考,希望对大家有所帮助!!!1).已知“装”字的拼音输入吗是“zhang”,而“大”字的拼音输入码是“da”,它们的国标码的长度的字节…

计算机管理扫不出我的独显,win10正式版系统下检测不到独立显卡的解决方法

通常很多电脑中都会有独立显卡,具备单独的显存,不占用系统内存,而且技术上领先于集成显卡,能够提供更好的显示效果和运行性能,然而有win10正式版系统用户却反应说遇到检测不到独立显卡的情况,但是自己电脑明…

北大计算机考研题一般出自哪里,北大计算机考研常见问题解答

北大计算机考研常见问题解答高校 免费考研论坛/2007-04-11原文内容来自免费考研论坛,请点击查看全文http://bbs.freekaoyan.com/viewthread.php?tid123937Q: 我想了解关于北大计算机(以下简称PKUCS)考研的基本情况、数据、规则,怎么办?A: 请…

iOS中通知的使用

一、NSNotificationCenter简介:NSNotificationCenter是一个单进程范围内的全局通知中心,每一个App都有一个单例的NSNotificationCenter,通过一个字符串来注册和触发通知,为不同类之间进行消息传递和函数调用提供了一种比较简单的方…

计算机组成原理201501,计算机组成原理201501.pdf

试卷代号 1254座位号rn 国家开放大学 中央广播电视大学 2014年秋季学期 开放本科 期末考试 计算机组成原理试题 2015年1月 一 选择题 每小题3分 共36分 1 下列数中最小的数是 A 101011 2 B 51 8 C 00111001 BCD D 103 16 2 两个补码数相加 只有在符号位一一一一一时有可能产生溢…

iOS零散知识点

1.通过UIDevice类的model属性可以得知当前设备是什么,比如模拟器、iPhone、iPad还是iPod。2.使屏幕不变暗:[[UIApplication sharedApplication] setIdleTimerDisabled:YES];3.UILabel多行文本(1)UILabel可以显示多行文本,它有一个属性叫numbe…

大连理工大学计算机原理实验,大连理工大学计算机原理实验第一次实验-20210406081759.pdf-原创力文档...

大连理工大学实验报告实验室(房间号) : 420 实验台号码: 班级: 电通 1402 姓名: 糜智华指导教师签字: 成绩:实验 一 汇编语言上机操作 &动态调试程序 DEBUG的使用 &运算类程序设计一、实验目的和要…

计算机硬件结构控制信息,计算机硬件的基本结构

在当前的信息社会中,计算机扮演着非常重要的角色. 以下是Baifen编辑器汇编的计算机硬件基本结构的内容. 欢迎阅读!电子数字计算机首先作为一种计算工具出现. 不难想象,如果计算机能够在没有人工干预的情况下自动完成计算,那么它必…

KVO和KVC简介

一、Key-Value-Observing--KVO(键值观察者模式)(1)简介:此机制可以在一个类中监听另外一个类的属性变化,包括我们自己的类和已有的Cocoa类库中的类。当被监听的类的属性发生了变化时,观察者会收到通知,可以针对属性变化添加自己的…

iOS中的异步和多线程概况

一、异步(1)当一个异步过程调用发出后,调用者不能立刻得到结果。实际处理这个调用的部件在完成后,通过状态、通知和回调来通知调用者。比如iOS类库中的NSURLConnectioin中使用代理的方式就是异步。(2)iOS类库中的异步调用提供自动的多线程并发&#xff0…

计算机系答辩麻烦,计算机专业的你,答辩时有多卑微?

你用英语都写不出来的东西就别指望用代码写了。又是一年毕业季,计算机专业的同学们,毕业设计都做好了吗?论文都写完了吗?查重过了吗?答辩准备好了吗?答辩,是你毕业前面临的最后一道关卡&#xf…

计算机A级作文,关于被计算机的作文(共一篇)-疾风作文网

【篇一:其物非故,其人亦存】科幻小说中,人工智能高度发达,甚至超过了人类的智力,计算机统治人类。看到这些,我们长舒一口气,或庆幸计算机智能暂时没有超过人类的风险,或是惴惴不安小…