Manipulating an NSString

Discussion in 'iOS Programming' started by ross.32, Jul 12, 2009.

  1. ross.32 macrumors 6502

    May 27, 2007
    If given a large HTML file in the form of a NSString, I need to create an array of substrings from the main string. I know what the first 4 characters of the substring will be.

    So basically what I have to do is seach the HTML file for those characters and return a string containing those first 4 characters and and X amount of characters after it.

    I then need to take every one of those substrings and put them in an array.

    What would be the easiest way of going about this? Thank you!
  2. lucasgladding macrumors 6502

    Feb 16, 2007
    Waterloo, Ontario
    The easiest is probably with the NSString class.

    This will strip the separating characters, but you could always step through the array and add them back afterward. Using an NSScanner could be used as well, but I believe that ignores the separating characters too.
  3. ross.32 thread starter macrumors 6502

    May 27, 2007

Share This Page