![](/img/trans.png)
[英]How to extract the particular string in XML without Parsing in iPhone?
[英]How to remove excess blank space in between the tags and extract only the content in xml parsing in iphone?
我是iPhone開發的新手,我想刪除標簽之間多余的空白,只提取xml解析中的內容。我的XML文件就像
<entry>
<title>This is sample test</title>
<published>xxxxxxxx</published>
<summary> This is summary </summary>
</entry>
我能夠解析XML文件並顯示所有內容。由於摘要內容的開頭和結尾都有空格,因此,由於只有空格顯示為“ this”,因此我想刪除該空格並顯示“這是摘要”。 請幫幫我。謝謝。
您可以使用- (NSString *)stringByTrimmingCharactersInSet:(NSCharacterSet *)set
方法修剪大量空間:
NSString* newString = [myString stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceCharacterSet]];
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.