• 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: string Manipulation
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: string Manipulation


  • Subject: Re: string Manipulation
  • From: Michelle Steiner <email@hidden>
  • Date: Thu, 20 Oct 2005 14:44:18 -0700

On Oct 20, 2005, at 11:25 AM, Walter L. wrote:

Thanks for your response Pete, but I'm still confused about how to read "\n" and "\r" and "return" seperately.

I'd like to be able to control how many returns are put into a new list or string from the original string/list after a line or paragraph. Some emails have multiple returns between paragraphs or returns in mid sentence between punctuation.

I'd like to isolate and break down the text into sections, put each section into a list or new string, then rebuild it controlling the spacing between paragraphs. There would also be no broken sentences.

Here is one way:

on break_paras(instring)
    set text item delimiters to return & return
    set tempParas to text tems of instring
    set text item delimiters to "••" --two bullets
    set tempstring to tempParas as text
    set tempParas to paragraphs of tempstring
    set text item delimiters to " " --one space
    set tempstring to temparas as text
    set text item delimiters to "••" --two bullets
    set temparas to text items of tempstring
    set text item delimiters to return & return
    set finalResult to temparas as text
    set text item delimiters to "" --null string
    return finalResult
end break_paras

This assumes that there are two carriage returns between paragraphs. It will keep all the paragraphs intact, and remove the breaks in the middle of the paragraphs.

I'm sure that Nigel, Dave, and/or Paul can come up with a more elegant way, though.

-- Michelle

--
"No" is not a bad word.

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


References: 
 >re: string Manipulation (From: "Walter L." <email@hidden>)

  • Prev by Date: Re: string Manipulation
  • Next by Date: Re: Days and hours
  • Previous by thread: Re: string Manipulation
  • Next by thread: Re: string Manipulation
  • Index(es):
    • Date
    • Thread