Re: is Shane's advice being collated?
Re: is Shane's advice being collated?
- Subject: Re: is Shane's advice being collated?
- From: 2551 <email@hidden>
- Date: Fri, 21 Nov 2014 17:39:44 +0700
> On 21 Nov 2014, at 12:01, Shane Stanley <email@hidden> wrote:
>
> He could change the last line to "return [reply substringToIndex:[reply length] - 1];", and the problem would be solved.
Nope, that would introduce a bug into the code in at least two obvious cases:
i. the method can be used to return the result of any NSTask. Making Shane's amendment will fail if the result is an NSArray or something else that doesn't respond to the length selector.
ii. even if the intended result was an NSString, if the result was null, Shane's amendment would likely cause a crash/
I've used and tested this method in a lot of different situations, and it's pretty robust. Any operations you want to do on the result (like stripping a string), need to be done at the caller's end.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden