How to remove excess blank space in between the tags and extract only the content in xml parsing in iphone?

StackOverflow https://stackoverflow.com/questions/2236003

  •  19-09-2019
  •  | 
  •  

Question

I am new to iphone Development.I want to remove excess blank space in between the tags and extract only the content in xml parsing.My XML file is like

<entry>
<title>This is sample test</title>
<published>xxxxxxxx</published>
<summary>                                       This is summary                             </summary>
</entry>

I am able to parse the XML file and display all the contents.Since there is blank spaces in the front and end of summary content,due to this only blank space is displayed with the word "this".I want to remove the blank space and display "This is summary". Please help me out .Thanks.

Was it helpful?

Solution

You can trim abundant spaces using - (NSString *)stringByTrimmingCharactersInSet:(NSCharacterSet *)set method:

NSString* newString = [myString stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceCharacterSet]];
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top