Re: Parsing out words in email subject
Re: Parsing out words in email subject
- Subject: Re: Parsing out words in email subject
- From: Thomas Fischer <email@hidden>
- Date: Fri, 29 Jan 2010 00:23:19 +0100
Yes, but
set theSubject to "Re: Parsing out words in email subject"
set theWord to first word of theSubject
set allButFirst to words 2 thru -1 of theSubject as text
display dialog allButFirst
will also give you the correct result.
It seems that words work here a little like text items with text item delimiters set to space.
But there are some additional subtleties (try quotes), and the AppleScript Language Guide says:
"Because the rules for parsing words are thus under user control, your scripts should not count on a deterministic text parsing of words."
Cheers
Thomas
Am 28.01.2010 um 21:23 schrieb Stockly, Ed:
>>> set theWord to first word of theSubject
>>> set allButFirst to words 2 thru -1 of theSubject
>>> set text item delimiters to space
>
>> The above script will squish space-delimited words into a single word, e.g."one
> two three" will come out "onetwothree".
>
> Actually, that snippet would result in a list composed of two, one-word
> strings:
>
> {"two", "three"}
>
> And a string with one word:
>
> "one"
>
> Here's a working example with the results of each command noted out to
> illustrate the flow:
>
> set theSubject to "one, two. three?"
> -->"one, two. three?"
>
> set theWord to first word of theSubject
> -->"one"
>
> set allButFirst to words 2 thru -1 of theSubject
> -->{"two", "three"}
>
> set text item delimiters to space
> -->{" "}
>
> set newString to allButFirst as text
> -->"two three"
>
> HTH,
>
> ES
>
>
>
> _______________________________________________
> 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
Attachment:
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________
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