Obj-C:[NSString stringWithString:@" string"] vs. @“string” [英] Obj-C: [NSString stringWithString:@"string"] vs. @"string"

查看:183
本文介绍了Obj-C:[NSString stringWithString:@" string"] vs. @“string”的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我看过人们做了 [NSString stringWithString:@some string] 。为什么不只是 @一些字符串

I've seen people do something like [NSString stringWithString:@"some string"]. Why not just do @"some string"?

例如,查看facebook-ios-sdk

For an example, look at the facebook-ios-sdk.

NSString stringWithString - 什么是point?是一个类似的问题,但没有答案地址 [NSString stringWithString:@some string] vs. @一些字符串

NSString stringWithString - what's the point? is a similar question, but none of the answers address [NSString stringWithString:@"some string"] vs. @"some string".

推荐答案

实际上没有区别。 [NSString stringWithString:str] 不执行任何操作,并返回 str if str 已不可变。

Actually there is no difference. [NSString stringWithString: str] just does nothing and returns str if str is immutable already.

这篇关于Obj-C:[NSString stringWithString:@" string"] vs. @“string”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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