• 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: deivy petrescu <email@hidden>
  • Date: Wed, 21 Mar 2007 17:55:48 -0400


On Mar 21, 2007, at 17:49, Michelle Steiner 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

Complementing Michelle's message:

<script>
set mystring to "Help, I'm caught between these parentheses, and I can't get out"


{first character of mystring, middle character of mystring, last character of mystring}
----{"H","p","t"}
</script>



Deivy _______________________________________________ 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: parsing strings
      • From: Michelle Steiner <email@hidden>
References: 
 >Parsing strings (From: "W. Thomas Leroux" <email@hidden>)
 >parsing strings (From: Michelle Steiner <email@hidden>)

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