• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: TID & text items issue
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

  • Follow-Ups:
    • Re: TID & text items issue
      • From: "John C. Welch" <email@hidden>
References: 
 >TID & text items issue (From: "John C. Welch" <email@hidden>)

  • Prev by Date: Re: Problem saving a new file
  • Next by Date: Re: TID & text items issue
  • Previous by thread: Re: TID & text items issue
  • Next by thread: Re: TID & text items issue
  • Index(es):
    • Date
    • Thread