Is it possible to trim a number to only keep the last 3 numbers ?
For exemple a phone number save in the variable, and I would like to keep the last 3 digit.
Ask Different is a question and answer site for power users of Apple hardware and software. It only takes a minute to sign up.Sign up to join this community
Here's one way. We set a variable called "the_phone_number" to some value, then pick off the last three characters. You can probably tell by inspection that it would be easy to modify this script to get the last four, or last two, or whatever.
set the_phone_number to "424-354-3548" set the_last_three to characters -3 thru -1 of the_phone_number as string