Skip navigation.
 
mlWriting Strings to a file and "special" strings.
FROM : Jerry LeVan
DATE : Sun Nov 03 18:50:29 2002

Ok,

I have about twelve thousand NSMutableStrings stored in a mutable array
(each element of the array is a mutable array of NSMutable strings,
representing the fields of a "line" of the target file).

The user is specifying the field separator, line  terminator and file name
via a dialog. ( So they might enter a \t for the field separator ).

I know from experimentation that the NSString @"\n" can be used to separate
a string into "lines" via

  // Build an array of each line
  lineList = [theFile componentsSeparatedByString:eol];

Where eol is defined by @"\n".

Do @"\t", @"\r" and @"\n" do the right thing when written to an "ascii"
file.

Is there an elegant way to write my giant array with say, my field elements
separated by @"\t" and each "line" terminated by @"\n" or @"\r" into an
ascii file?

Does anyone know why if a textField contains a\bc then NSLog will print the
backslash character four times ie

NSLog(@"result=%@", [textField stringValue]) will print a\\\\b ?

--Jerry
_______________________________________________
cocoa-dev mailing list | <email_removed>
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

Related mailsAuthorDate
mlWriting Strings to a file and "special" strings. Jerry LeVan Nov 3, 18:50
mlRe: Writing Strings to a file and "special" strings. Jonathan Jackel Nov 4, 02:33