• 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: Newbie: How to understand Xcode's documentation
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Newbie: How to understand Xcode's documentation


  • Subject: Re: Newbie: How to understand Xcode's documentation
  • From: Graham Cox <email@hidden>
  • Date: Wed, 16 Jul 2008 11:07:25 +1000

Along with what others have said, for this specific task you would probably want to use:

-(NSString*) substringWithRange:(NSRange) range;

instead. It's fairly rare to break down strings into individual characters.

So with your newly learned knowledge of Objective-C, you could now write a bit of code such as:


[newField setStringValue:[[oldField stringValue] substringWithRange:NSMakeRange(2, 3)]];




cheers, Graham



On 16 Jul 2008, at 8:19 am, Phil Faber wrote:

For example, if I want to put a substring of a larger string (eg. "ertyu" from "qwertyuiop") into a second field, I search the documentation and come across a thing under NSString called getCharacters:range. I assume this will do the job as it seems to get characters from a string as specified by a range; I then look at the usage information which reads:

- (void)getCharacters:(unichar *)buffer range:(NSRange)aRange

_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


References: 
 >Newbie: How to understand Xcode's documentation (From: Phil Faber <email@hidden>)

  • Prev by Date: Re: Blue lines
  • Next by Date: Re: [[NSDate alloc] initWithString] crashes with valid string
  • Previous by thread: Re: Newbie: How to understand Xcode's documentation
  • Next by thread: Re: Newbie: How to understand Xcode's documentation
  • Index(es):
    • Date
    • Thread