• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Writing Strings to a file and "special" strings.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Writing Strings to a file and "special" strings.


  • Subject: Writing Strings to a file and "special" strings.
  • From: Jerry LeVan <email@hidden>
  • Date: Sun, 03 Nov 2002 12:50:29 -0500

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@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.

  • Follow-Ups:
    • Re: Writing Strings to a file and "special" strings.
      • From: Jonathan Jackel <email@hidden>
  • Prev by Date: Re: MVC and thread-safety
  • Next by Date: I want a scrollbar
  • Previous by thread: Re: NSTask problem...
  • Next by thread: Re: Writing Strings to a file and "special" strings.
  • Index(es):
    • Date
    • Thread