• 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: How to parse a textfile ?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to parse a textfile ?


  • Subject: Re: How to parse a textfile ?
  • From: Michelle Steiner <email@hidden>
  • Date: Tue, 28 Sep 2004 11:17:32 -0700


On Sep 28, 2004, at 6:43 AM, Stefan Eriksson wrote:

any suggestions, parsing text in AS seems lika a major pain...

Here is a vanilla applescript way of doing it; the script relies on the assumption that no line before the date line has a hyphen in the fifth position.


set foo to paragraphs of ¬
	"blah
blah
2004-09-15
00509562/00000147
11548
blah
blah"

repeat with i from 1 to (count foo)
	if (count of item i of foo) is greater than 5 and ¬
		character 5 of item i of foo is "-" then
		return item (i + 1) of foo
		exit repeat
	end if
end repeat

--
Stop Mad Cowboy Disease:  Vote for Kerry

_______________________________________________
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: 
 >How to parse a textfile ? (From: Stefan Eriksson <email@hidden>)

  • Prev by Date: Re: Getting human-understandable time from iCal
  • Next by Date: Re: dropping folders
  • Previous by thread: Re: How to parse a textfile ?
  • Next by thread: Re: How to parse a textfile ?
  • Index(es):
    • Date
    • Thread