• 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: parsing strings
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: parsing strings


  • Subject: Re: parsing strings
  • From: "W. Thomas Leroux" <email@hidden>
  • Date: Wed, 21 Mar 2007 17:54:43 -0400

Awesomeness.  Thanks Michelle!

I should have known it would be something simple like that.  But the
programmer in me.. must.. resist... ;-)

Thomas

On 3/21/07, Michelle Steiner <email@hidden> wrote:

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



--
All about me!
http://www.leroux.ca
_______________________________________________
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
References: 
 >Parsing strings (From: "W. Thomas Leroux" <email@hidden>)
 >parsing strings (From: Michelle Steiner <email@hidden>)

  • Prev by Date: parsing strings
  • Next by Date: Re: parsing strings
  • Previous by thread: parsing strings
  • Next by thread: Re: parsing strings
  • Index(es):
    • Date
    • Thread