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 (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to