What can I do with an NSRange in Objective-C?
What can I do with an NSRange in Objective-C?
- Subject: What can I do with an NSRange in Objective-C?
- From: Jerry Krinock <email@hidden>
- Date: Sun, 08 Feb 2004 14:22:28 -0800
Hi,
I want to use the method -rangeOfCharacterFromSet on an NSString*.
Unfortunately, this method returns an NSRange, and there seems to be very
few methods in the NSRange API for Objective-C. In particular, there are no
accessor methods. The only thing I can find to do with this NSRange is to
convert it to a string using NSStringFromRange (which is an "Objective-C
Classic" function), and then parse the string to get the "range" and
"length" integers. That would be quite a kludge!
Look at the left frame in here and you'll see NSRange API listed for Java,
but none for Objective-C.
http://developer.apple.com/documentation/Cocoa/Conceptual/GeometryandRange/i
ndex.html#//apple_ref/doc/uid/10000046i
Am I missing something?
I do find this declaration:
typedef struct _NSRange {unsigned int location; unsigned int length;}
NSRange;
Can I dig into this struct and access those two ints the old-fashioned way?
Jerry Krinock
San Jose, CA USA
_______________________________________________
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.