tagstart(
THETEXT
,
HEADER
,
TRAILER
,
ITEM
)

The tagstart( function returns the starting position of the specified tag (usually an HTML tag) in the text.


Parameters

This function has four parameters:

thetext – is the item of text that contains the tag you want to locate.

header – is the text that you want to use as a tag header. For example, if you want to locate an HTML tag, use "<" as the header. If you wanted to locate a bold text item you would use "<B>" as the header. (Note: Upper or lower case is ignored, so "<b>" will also work.)

trailer – the text that you want to use as a tag trailer. For example, if you want to locate an HTML tag, use ">" as the trailer. If you wanted to locate a bold text item you would use "</B>" as the trailer. (Note: Upper or lower case is ignored, so "</b>" will also work.)

item – is the number of the tag you want to extract. For example, suppose you are using "<" and ">" as the tag header and tag trailer. Using an item number of 1 will locate the first tag, 2 the second tag, 3 the third tag, etc.


Description

This function returns the start position of the specified tag within the text (just after the tag header). If the tag is not found, the result will be zero.

This example assumes you have a field or variable named myPage that contains an HTML page that is being edited with a text superobject named PageEditor. The example will locate and select the title of the web page.

local tStart,tEnd
tStart=tagstart(myPage,"<title>","</title>",1)
if tStart=0
    rtn
endif
tEnd=tagend(myPage,"<title>","</title>",1)
objectaction "PageEditor","setselection",tStart-1,tEnd-1

See Also


History

VersionStatusNotes
10.0No ChangeCarried over from Panorama 6.0