开发者

define a long complex literal string

I have a string that is quite long and complicated, with special characters inside. I want to define this string as a variable开发者_如何转开发, but don't want to escape each of them (because there are so many). I remember that in XML they have a special syntax for that, is there something similar for Objective-C?

Edit: I know I can save the thing in a file and load it easily, but is it possible to do so without a new file? I'm having quite some of them...


No, you have to escape the characters (though you only have to escape ", \, and control characters... is the string mostly control characters and quotes?)

A better idea might be to put the string in a file. Load it using +[NSString stringWithContentsOfFile:encoding:error:].

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜