itemDelimiter -- Fix

Mark Brownell gizmotron at earthlink.net
Tue Mar 23 15:28:36 EST 2004


From: Mark Brownell
*	Subject: Re: itemDelimiter
*	Date: Thu, 12 Feb 2004 09:05:30 -0800

To fix archives:

This is the latest that works, and thanks to Wouter it also fixes 
attributes that begin different but end the same. I forgot about space 
and SGML requirements.

Example tag set from this thread:
<BODY TEXT="#000000" BGCOLOR="#F8D0B8" LINK="#999999" VLINK="#000000" 
ALINK="#FF0000">blab here website</BODY>

New function:
-- put PNLPgetAttribute("name", tElementFound) into theAttribute
function PNLPgetAttribute tAttribute, strngToSearch
   put empty into zapA
   put quote into Qx
   if char 1 of tAttribute = space then
     put tAttribute & "=" & Qx into tAttributeX
   else
     put space & tAttribute & "=" & Qx into tAttributeX
   end if
   put the number of chars in tAttributeX into dChars
   put offset(tAttributeX,strngToSearch) into tNum1
   if tNum1 < 1 then
     return "error"
     exit PNLPgetAttribute
   end if
   put tNum1 + dChars into tNumX
   put offset(Qx,strngToSearch,tNumX) into tNumZ
   if tNumX < 1 then
     return "error"
     exit PNLPgetAttribute
   end if
   if tNumZ < 1 then
     return "error"
     exit PNLPgetAttribute
   end if
   put char tNumX to (tNumX + (tNumZ - 1)) of strngToSearch into zapA
   return zapA
end PNLPgetAttribute

Mark



More information about the use-livecode mailing list