• 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
Re: NSTextView - read line by line?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSTextView - read line by line?


  • Subject: Re: NSTextView - read line by line?
  • From: Hasan Diwan <email@hidden>
  • Date: Wed, 16 Apr 2003 15:30:51 -0700

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

NSArray *textLines = [[myTextView string] componentsSeparatedByString:@"\n"];
NSEnumerator *e = [textLines objectEnumerator];
id i;
while (i = [e nextObject]) {
...
}
On Wednesday, Apr 16, 2003, at 13:38 US/Pacific, John C. Randolph wrote:

On Wednesday, April 16, 2003, at 01:15 PM, Steve Woodward wrote:

I've been RTFMing but have not discovered the right/best way to read text that's in a TextView line by line. What I am looking to do is get a list of items that the user types in and process that list one item at a time. Is there another more appropriate control for this purpose? Many thanks in advance!

NSString *thisLine, *allTheText = [myTextView string];
NSEnumerator *lines = [allTheText componentsSeparatedByString:@"\n"];

while (thisLine = [lines nextObject])
[self doSomethingWithLine:thisLine];

HTH,

-jcr

John C. Randolph <email@hidden> (408) 974-8819
Sr. Cocoa Software Engineer,
Apple Worldwide Developer Relations
http://developer.apple.com/cocoa/index.html
_______________________________________________
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.

Hasan Diwan {http://ibn.com/~hdiwan}
OpenPGP Fingerprint: 275D 0E84 550C D92A 4A56 732C 8528 2579 E6E9 4842
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (Darwin)

iD8DBQE+ndmmhSgleebpSEIRAjD0AKCDmokQzdn1jc43Dur6Nxlm+cefnwCeJOxD
qMi4z1rt7i3US0fWLg2FR94=
=fsKc
-----END PGP SIGNATURE-----
_______________________________________________
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.

References: 
 >Re: NSTextView - read line by line? (From: "John C. Randolph" <email@hidden>)

  • Prev by Date: Re: NSTableView and Scrollbars
  • Next by Date: Re: Unix Network Programming by Stevens && Mac OS X...
  • Previous by thread: Re: NSTextView - read line by line?
  • Next by thread: Re: NSTextView - read line by line?
  • Index(es):
    • Date
    • Thread