You are viewing an old version of this page. View the current version.
Compare with Current
View Page History
« Previous
Version 7
Next »
SECTION$ returns a section from a document starting and ending with lines containing specific strings
Syntax
SECTION$(Document$, PageHeader$, PageEnd$, [AddLines%=>0])
Arguments
- Document$ is a string containing the source document.
- PageHeader$ is a sub string of Document$ which indicates the first line of the section.
- PageEnd$ is a sub string of Document$ that indicates the end of the section.
The result starts with the first line of Document$ containing PageHeader$ and ends with the line just before the line containing PageEnd$. - AddLines% is an optional value, containing the number of lines to be added at the end of the section. E.g. when AddLines%=1, also the line containing PageEnd$ is included.
- If PageHeader$="NullString", the function returns "NullString".
- If PageHeader$ is not found, the function also returns "NullString".
- If PageEnd$="NullString", the function returns all text from Document starting with PageHeader$.
- If PageEnd$ is not found, the function also returns all text from Document starting with PageHeader$.
- The last line of the result returned by SECTION$() is always terminated by a CrLf (Carriage Return + LineFeed: Chr$(13)+Chr$(10) ). Multiple repeating CrLf's at the end of an extracted section are removed as well as trailing strings from each line in that result.
- One can also use the PARAGRAPH$() function to return a section of a document.
Examples
Assuming a document with the following text:
then
returns
returns
Because "Ceremony" does not occur in Document$. Note, the function is case sensitive.
returns
"NullString"
since "falls apart" is not present in Document$.
returns
Two more lines are included.
Quick links: Function overview | Attribute overview | Constants overview | Dimensions overview