• 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: Comma delimited paragraph
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Comma delimited paragraph


  • Subject: Re: Comma delimited paragraph
  • From: Christopher Stone <email@hidden>
  • Date: Thu, 18 May 2017 09:53:08 -0500

On 05/18/2017, at 09:03, email@hidden wrote:
I have a list of 10 digit order number that come from a variety of sources, including excel spreadsheets and email.  I’m trying to figure out how to copy the list and format the clipboard 
to be comma delimited, deleting any carriage returns, empty lines, spaces, etc.


Hey AG,

I like to use the Satimage.osax (Scripting Addition) for this sort of thing.

It's available (here), but I prefer to use the most recent version on the Smile Beta page (here).

It adds regular _expression_ support to AppleScript and many other goodies, so jobs like this are supremely easy.

-------------------------------------------------------------------------------------------
set dataStr to "
2666402402
2666838403
2651918574
2603572532
2524040907
2570477380
2557200473
2576205981
2665747816
2673705862
2660671146

2666402402: 2666838403,  2651918574 2603572532, 2524040907 2570477380  2557200473 2576205981
  2665747816 2673705862 2660671146
"

# Grab all congiguous digit strings to an AppleScript list object.
set newDataStr to find text "\\d+" in dataStr with regexp, all occurrences and string result
# Join the list to produce CSVs.
set newDataStr to join newDataStr using ","
-------------------------------------------------------------------------------------------

--
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: 
 >Comma delimited paragraph (From: "email@hidden" <email@hidden>)

  • Prev by Date: Re: Comma delimited paragraph
  • Next by Date: Re: Comma delimited paragraph
  • Previous by thread: Re: Comma delimited paragraph
  • Next by thread: Re: Comma delimited paragraph
  • Index(es):
    • Date
    • Thread