Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You could use this to strip out the unwanted bits:</p> <pre><code>[yourString stringByReplacingOccurrencesOfString:@"&lt;br&gt;" withString:@""]; </code></pre> <p>Then you would use something like this to remake your string the way you want it:</p> <pre><code>NSString *newString = [NSString stringWithFormat:@"&lt;br&gt;%@&lt;br&gt;", yourString]; </code></pre> <p>You might also want to look at stringByTrimmingCharactersInSet:</p> <p>There are so many things you can do with NSString. Check out the Class Reference: <a href="https://developer.apple.com/library/mac/#documentation/Cocoa/Reference/Foundation/Classes/NSString_Class/Reference/NSString.html" rel="nofollow">https://developer.apple.com/library/mac/#documentation/Cocoa/Reference/Foundation/Classes/NSString_Class/Reference/NSString.html</a></p> <p>EDIT: </p> <p>substringToIndex: could be your friend here. You can do this to find out if the first 4 characters of your string consist of the characters you want to remove:</p> <pre><code>NSString *subString = [yourString substringToIndex:4]; if ([subString isEqualToString:@"&lt;br&gt;"]) { yourString = [yourString substringFromIndex:4]; } </code></pre> <p>Then you are creating a new string without those 4 characters. You keep doing this until the first 4 character are not equal to the ones you want to remove.</p> <p>You can do something similar at the end of your string using substringFromIndex. You will need to know the length of your original string to make sure none of your substrings go out of bounds.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload