How can I get the selected text's string from a NSTextView
as an NSString
?
Your help is greatly appreciated.
Since NSTextView is a subclass of NSText, you can use NSText instance methods to figure out the selected string like so:
NSString *selected = [[myTextView string]
substringWithRange:[myTextView selectedRange]];