This seems like a simple task, but it has become a series of steps. Am I missing a simple method that will do this?

I have a Text View and want to get the selected text in an NSString form. I can get an NSString for the entire NSTextView (-string), but to get the string for just the selected text seems to take multiple steps:

        NSRange range = [theTextView selectedRange];
        NSData* rtfData = [theTextView RTFFromRange: range];
NSAttributedString* aStr = [[NSAttributedString alloc] initWithRTFData:rtfData documentAttributes: NULL];
        NSString* str = [aStr string];

Is there a method that combines all these steps?

Thanks,

Todd

_______________________________________________

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 arch...@mail-archive.com

Reply via email to