需要在 Objective-C NSString 对象中转义的字符 [英] Characters that need to be escaped in an Objective-C NSString object

查看:93
本文介绍了需要在 Objective-C NSString 对象中转义的字符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

想知道整个字符集,其字符必须在 Objective-C NSString 对象中转义才能被正确识别,例如" 必须转义为 \",如

Want to know the whole character set whose characters have to be escaped in an Objective-C NSString object in order to be recognized properly, e.g. " has to be escaped as \", as in

NSString *temporaryString = @"That book is dubbed as \"the little book\".";

字符集和C语言char *字符串中的字符集一样吗?

Is the character set same with the one in C language char * string?

感谢您的帮助 :D

推荐答案

唯一需要转义的字符是 "(双引号)和 \(反斜杠)字符.

The only characters that have to be escaped are the " (double-quote) and \ (backslash) characters.

还有其他特殊字符文字,例如 \n 具有特殊含义,但这些实际上是一个单独的问题.

There are other special character literals such as \n that have special meaning but those are really a separate issue.

Objective-C NSString 值使用与 C 相同的一组特殊字符.

Objective-C NSString values use the same set of special character literals as C.

这篇关于需要在 Objective-C NSString 对象中转义的字符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆