Text file question

I have a text file with the following structure:

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

I can read it in the array successfully, but the string @/@/@/is a delimiter. I want to split NSArrayinto helper arrays in a separator.

Any suggestion how to solve this?

I also need to change a specific section.

Regards

+3
source share
2 answers

If you read it as an NSString, then

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

Use components of SeparatedByString method. You can save the value obtained in the array.

0
source

All Articles