AMH
AMH

Reputation: 6451

text file question

I have text file that with the following structure:

test\n 
1\n
2\n
@/@/@/\n
test2 \n
223\n
44\n
@/@/@/\n

I can read it in array successfuly , but the line @/@/@/ is separator. I want to divide the NSArray to sub arrays at the separator.

Any suggestion how to solve that?

I also need to modify certain section.

Best regards

Upvotes: 3

Views: 67

Answers (2)

Devraj
Devraj

Reputation: 3065

If you read it in as a NSString then

NSArray *chunks = [string componentsSeparatedByString: @"@/@/@/"];

Upvotes: 3

Aditya
Aditya

Reputation: 4396

Use componentsSeparatedByString method.You can store the value obtained in an Array.

Upvotes: 0

Related Questions