N S
N S

Reputation: 2603

NSString get text between certain characters

If I have an NSString with something like this in it: Note Title Here:@:Note Description Here:@:123839:@:High Priority How can I separate out the strings between the ":@:" characters? I would know how many segments to expect if using something other than an array/for-loop would be easier.

Thanks!

Upvotes: 1

Views: 875

Answers (1)

Daniel
Daniel

Reputation: 4967

Take at look at the componentsSeparatedByString: method. It should do what you want

[myString componentsSeparatedByString: @":@:"]

should give you an NSArray instance containing the parts of the string split out

Upvotes: 4

Related Questions