• 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: Question from a proverbial newbie
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Question from a proverbial newbie


  • Subject: Re: Question from a proverbial newbie
  • From: Christopher Stone <email@hidden>
  • Date: Sat, 8 Aug 2009 18:44:24 -0500

On Aug 08, 2009, at 15:14, Angelo wrote:
How can I take the text variable phone, which is comprised of the ten digits of a phone #, and split it up into 3 variables in which I can insert dashes?

ie:  
phone_no_with_dashes = var1 + "-" + var2 + "-" + var3
______________________________________________________________________

Hey Angelo,

I like to use the Satimage Osax's change command with regular expressions for such things.

set phoneNum to "123456789"

set findData to phoneNum
set findString to "(\\d{3})(\\d{3})(\\d{3})"
set changeString to "\\1-\\2-\\3"

set changeResult to change findString ¬
into changeString ¬
in findData ¬
with regexp


Best Regards,

Chris

 _______________________________________________
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: 
 >Question from a proverbial newbie (From: Angelo <email@hidden>)

  • Prev by Date: Re: Question from a proverbial newbie
  • Next by Date: FW: Question from a proverbial newbie
  • Previous by thread: Re: FW: Question from a proverbial newbie
  • Next by thread: Auto: AppleScript-Users Digest, Vol 6, Issue 362
  • Index(es):
    • Date
    • Thread