Re: Text Manipulation
Re: Text Manipulation
- Subject: Re: Text Manipulation
- From: "Marc K. Myers" <email@hidden>
- Date: Thu, 09 May 2002 12:03:36 -0400
- Organization: [very little]
>
Date: Thu, 9 May 2002 20:31:45 +1000
>
Subject: Text Manipulation
>
From: Robert Stretch <email@hidden>
>
To: AppleScript List <email@hidden>
>
>
Hi there,
>
>
I've got a small problem with text manipulation. I have a text file
>
which i am reading via:
>
>
do shell script "cat <path to text file>"
>
set thestring to the result
>
>
The following is just a small section of the text file inside the
>
variable thestring:
>
"%sf -something.rsrc
>
-/System/Library/Frameworks/Carbon.framework/Versions/A/Frameworks/HiToolbox.
>
framework/Versions/A/Resources/Extras.rsrc"
>
without the quotes and all on the same line if Mail cuts it up.
>
>
I found the text item number that "Extras.rsrc" begins with using the
>
offset command (I need this to find out which paragraph the rest of this
>
is in), but how do I find out comes between the first "-" and the
>
second "-"? I was thinking of using a loop which worked systematically
>
backwards through each text item until it finds one with "-" in it, but
>
i'm unsure of the syntax. If anybody can help it would be greatly
>
appreciated!
I'd do it with AppleScript's text item delimiters:
set {od, AppleScript's text item delimiters} to [optn-L]
{AppleScript's text item delimiters, {"-"}}
try
set foundText to text item 2 of theString
on error
set foundText to ""
end try
set AppleScript's text item delimiters to od
NB: "[optn-L]" stands in for the AppleScript continuation character.
Marc K. Myers <email@hidden>
http://AppleScriptsToGo.com
4020 W.220th St.
Fairview Park, OH 44126
(440) 331-1074
[5/9/02 11:59:39 AM]
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.