Want to highlight a helpful answer? Upvote!

Did someone help you, or did an answer or User Tip resolve your issue? Upvote by selecting the upvote arrow. Your feedback helps others! Learn more about when to upvote >

Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

read last 2 characters from string

Hi, I want to read the last 2 characters from a string, the length of the string is not fixed.
Tried it with the "set xx to character 10 thru -1 of xx as string" but only get off course the character of position 10.

Posted on Oct 24, 2005 10:00 AM

Reply
4 replies

Oct 24, 2005 4:25 PM in response to Spencer Lips

Hi Spencer,

Adding to the info you've already gotten in this thread...

Try this:

set xx to "test string"
set xx to text -2 through -1 of xx
--sets xx to the text string "ng"

or this:

set xx to "test string"
set xx to characters -2 through -1 of xx
--sets xx to the list {"n", "g"}

depending on how you need the characters returned to you in your script.

Hope this helps...

read last 2 characters from string

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.