Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/algorithm/12.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何从HTML字符串中提取文本并集成回HTML字符串?_Html_Ios_Uiwebview - Fatal编程技术网

如何从HTML字符串中提取文本并集成回HTML字符串?

如何从HTML字符串中提取文本并集成回HTML字符串?,html,ios,uiwebview,Html,Ios,Uiwebview,在我的应用程序中,如果单击编辑选项,我允许用户编辑UIWebView中显示的文本 我使用下面的方法来提取webview中显示的文本 NSString *htmlString=@"<p style="letter-spacing:0px;color:#3485BD;font-size:24pt;font-family:Arial;text-anchor:start;text-align:start;" id="textArea_1">Enter Your Question</p&

在我的应用程序中,如果单击编辑选项,我允许用户编辑
UIWebView
中显示的文本 我使用下面的方法来提取webview中显示的文本

NSString *htmlString=@"<p style="letter-spacing:0px;color:#3485BD;font-size:24pt;font-family:Arial;text-anchor:start;text-align:start;" id="textArea_1">Enter Your Question</p>";
NSCharacterSet *set=[NSCharacterSet characterSetWithCharactersInString:@"><"];
NSArray *arr1=[htmlString  componentsSeparatedByCharactersInSet:set];
所需的文本位于索引2,我在UITextField中显示它供用户编辑,但我不知道如何将编辑后的文本集成到HTML字符串中


因为我使用NSCharacterSet对象分解,该对象包含chars>和由CharactersInSet分离的组件,但不可能集成。如果有其他方法,请帮助我?

[result objectAtIndex:2]
将返回“输入您的问题”。@anopvaidya我现在更正了我的问题tum chahte ho ki“输入您的问题”ko edit karne ke baad jo text ho wo HTML string me replace ho jaye?您希望编辑的文本替换“输入您的问题”@AnoopVaidya是的,我希望编辑的文本替换“输入您的问题”,我认为很简单。。。您一定听过
swap
。。。。同样的事情
(
    "",
    "p style=\"letter-spacing:0px;color:#3485BD;font-size:24pt;font-family:Arial;text-anchor:start;text-align:start;\" id=\"textArea_1\"",
    "Enter Your Question",
    "/p",
    ""
)