Re: Missing ampersand
Re: Missing ampersand
- Subject: Re: Missing ampersand
- From: Shane Stanley <email@hidden>
- Date: Sat, 25 Mar 2017 21:56:55 +1100
On 25 Mar 2017, at 10:33 am, Christopher Stone <email@hidden> wrote:
AppleScriptObjC works quite well for this as well and returns the same result. (This is equivalent to using AppleScript's text item delimiters.)
Yes, although the equivalent to your other handlers, which split on any white space characters including line breaks, would be:
use framework "Foundation" use scripting additions
set theString to "eric v smith & jones"
set stringComponentList to my splitOnAnySpace:theString
on splitOnAnySpace:someText -- free to a good home set theString to current application's NSString's stringWithString:someText set theList to theString's componentsSeparatedByCharactersInSet:(current application's NSCharacterSet's whitespaceAndNewlineCharacterSet()) return theList as list end splitOnAnySpace:
Or roughly:
use framework "Foundation" use scripting additions
set theString to "eric v smith & jones"
set stringComponentList to my splitString:theString atCharactersInString:(linefeed & return & tab & space)
on splitString:someText atCharactersInString:stringOfChars -- free to a good home set theString to current application's NSString's stringWithString:someText set theList to theString's componentsSeparatedByCharactersInSet:(current application's NSCharacterSet's characterSetWithCharactersInString:stringOfChars) return theList as list end splitString:atCharactersInString:
|
_______________________________________________
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