Dividing Strings
Dividing Strings
- Subject: Dividing Strings
- From: Chuck Rice <email@hidden>
- Date: Sun, 12 Jan 2003 21:13:20 -0800
I am new to Cocoa and and kind of new to C, though I have been
programming in assembler for years. I am trying to divide a string I
have retrieved from a Cell Phone:
7,"4083747418",129,"El Grullenese, Mexican",0,0,255,0,1
I am using:
NSMutableString * aLine;
NSArray * listItems;
listItems = [aLine componentsSeparatedByString:@","];
To split a string into an array of strings. This works great for most
lines, but as you can see, in the example, there is a comma in the
quoted name field. It still parses, but is not what I wanted since
everything past that gets stored in the wrong column.
My question is, is there a better function to accomplish this, or
will I need to do the parsing the hard way with a loop, looking at
each character? Cocoa seems to have a really rich feature set, so I
thought there might be a better way. Any help would be appreciated. I
have spent a lot of time looking, but there is an awful lot of doc to
see. -Chuck-
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.