xcode 添加两个字符串

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/5131722/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-14 20:20:04  来源:igfitidea点击:

xcode adding two strings

stringxcode

提问by begna112

i feel retarded for even asking this because its on the tip of my tongue metaphorically but here we go

我什至因为这个问题而感到迟钝,因为它隐喻地在我的舌尖上,但我们走了

i need to make an NSString called "HTMLData" out of two already existing strings called "summaryString" and "resizingString".

我需要从两个已经存在的名为“summaryString”和“resizingString”的字符串中创建一个名为“HTMLData”的 NSString。

where resizingString is this (how would you make this into a string?):

这是 resizingString 在哪里(你怎么把它变成一个字符串?):

<meta name='viewport' content='width=device-width; initial-scale=1.0; maximum-scale=1.0;'>

and the summary string is decoded xml

并将摘要字符串解码为 xml

how do i do that?

我怎么做?

im fairly certain its something like this but its not working

我相当肯定它是这样的,但它不起作用

NSString *HTMLData = resizingString + summaryString;

NSString *HTMLData = resizingString + summaryString;

回答by Espresso

NSString *HTMLData = [resizingString stringByAppendingString: summaryString];

Refer to the NSString Class Referencefor more info and methods...

有关更多信息和方法,请参阅NSString 类参考...