Re: TID & text items issue
Re: TID & text items issue
- Subject: Re: TID & text items issue
- From: Shane Stanley <email@hidden>
- Date: Tue, 23 Oct 2012 10:07:39 +1100
On 23/10/2012, at 9:38 AM, John C. Welch <email@hidden> wrote:
> I have a string:
>
> " 8 0 0xffffff7f81592000 0x41000 0x41000
> com.apple.kec.corecrypto (1.0) "
>
> I want to strip out the stuff that isn't spaces. Should be easy. Set TIDs
> to " ", and get every text item. The problem is, I get a listing for the
> delimiters too, and then I'm in repeat hell.
>
> I could SWEAR this used to work better, as in the delimiters didn't get in
> the list, just the stuff that wasn't delimiters.
It's always worked that way. You can get close to what you want by using multiple delimiters:
set x to " 8 0 0xffffff7f81592000 0x41000 0x41000 com.apple.kec.corecrypto (1.0) "
set saveTID to AppleScript's text item delimiters
set AppleScript's text item delimiters to {" ", " ", " ", " "} -- from most to least order
set y to text items of x
set AppleScript's text item delimiters to saveTID
--> {"", "8", "0", "0xffffff7f81592000", "0x41000", "0x41000", "com.apple.kec.corecrypto", "(1.0)", ""}
That still leaves the potential leading and trailing empty string.
--
Shane Stanley <email@hidden>
'AppleScriptObjC Explored' <www.macosxautomation.com/applescript/apps/>
_______________________________________________
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