parsing strings
parsing strings
- Subject: parsing strings
- From: Michelle Steiner <email@hidden>
- Date: Wed, 21 Mar 2007 14:49:29 -0700
On Mar 21, 2007, at 2:27 PM, W. Thomas Leroux wrote:
I am trying to figure out how to parse strings like in some other
languages I use - in particular, an applescript equivalent to the
mid(), left() and right() commands.
I've googled around and read through the AppleScript Language Guide,
but I'm not finding what I'm looking for.
Specifically, I'm trying to capture the rightmost character of a
string.
set mystring to "Help, I'm caught between these parentheses, and I
can't get out"
last character of mystring
character -1 of mystring
character (count of mystring) of mystring
For any arbitrary run of a string
text (startposition) through (endposition) of mystring
For example:
text 3 through 5 of mystring
--> "lp,"
text 13 through end of mystring
--> "ught between these parentheses, and I can't get out"
text 13 through -1 of mystring
--> "ught between these parentheses, and I can't get out"
If you replace "text" in the above with "characters", you get a list:
characters 13 through 22 of mystring
--> {"u", "g", "h", "t", " ", "b", "e", "t", "w", "e", "e"}
-- Michelle
--
If you don't hit any bumps in the road, you're not moving.
_______________________________________________
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