• 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: Take part of a string
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Take part of a string


  • Subject: Re: Take part of a string
  • From: email@hidden
  • Date: Sun, 2 Jun 2002 14:00:59 -0700

malcom,

This is your fourth or fifth simple question in the last couple of days that indicates strongly that you have never tried to read any of the documentation.

If you would type NSString into project builder, and press command and double-click on the word NSString, you would see the header file. If you press Option and double-click you will have the documentation!

/System/Library/Frameworks/Foundation.framework/Versions/C/Resources/English.
lproj/Documentation/Reference/ObjC_classic/Classes/NSString.html

Your question is "how can I divide a big string into many small strings divided by the return character?"

I looked at the documentation for ten seconds (hit page down three times) and saw in the section called "Method Types", a subsection called "Dividing strings", and the first method there called componentsSeparatedByString:

Thus, the answer to your question is:

NSArray *lines = [x componentsSeparatedByString:@"\r\n"];

Please spend ten seconds looking at the documentation you already have in your development environment before posting every question you have to the list.

You could save us all time by telling us what you're writing, and have us write it for you and just send you the solution...


On Sunday, June 2, 2002, at 01:17 PM, malcom wrote:

Hello,

I have a NSString object with many text. Every block contained in this
object ends with a return character. I would to take the x block (where x is
an arbitrary number of block) and parse it as I would... Can I do this? How?
_______________________________________________
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: 
 >Take part of a string (From: malcom <email@hidden>)

  • Prev by Date: CFXML problems
  • Next by Date: Re: cocoa-dev digest, Vol 2 #728 - 16 msgs
  • Previous by thread: Re: Take part of a string
  • Next by thread: CFXML problems
  • Index(es):
    • Date
    • Thread