Parsing strings

I have a script where I need to parse strings. I am just starting it off and have been stopped by “starts with” not working.


set master to ("/Users/admin/Desktop/vcards.vcf" as POSIX file)
open for access master
set vcarddata to read master using delimiter [return]
close access master
repeat with vcardline in vcarddata
	if vcardline starts with "N:" then
		display dialog vcardline
	end if
end repeat

There are, of course, lots of lines that start with “N:” yet this script displays none. How can I screw up something that seems so simple? TIA.

Something else is going on: This works with both starts and begins.

set vcarddata to {"Adam", "N:oodle", "Hello", "N:oon"}

repeat with vcardline in vcarddata
	if vcardline starts with "N:" then
		display dialog vcardline
	end if
end repeat

Hi.

try this:


set master to ((path to desktop as text) & "vcards.vcf")
set vcarddata to paragraphs of (read file master)
repeat with vcardline in vcarddata
	if vcardline starts with "N:" then
		display dialog vcardline
	end if
end repeat

The problem is, if the line delimiter is LF (ASCII 10), the line never starts with N:

Thanks, that was it. When I change the delimiter to ACSII Character 10, it worked.