textfilter(
TEXT
,
FILTER
)

The textfilter( function scans and filters text on a character by character basis.


Parameters

This function has two parameters:

text – is the text to be scanned and filtered.

filter – is a formula that calculates a dictionary. This dictionary contains two entries: SKIP and APPEND. The SKIP entry must be an integer value that tells Panorama how many characters to skip before resuming scanning. The APPEND entry contains text to be appended to the result of the function. Within the formula you can use the import() function to retrieve the original text starting from the current location, or the seq() function to retrieve the position of the character within the text. Note: The overall formula must be quoted (using quote characters that are not used anywhere in the formula itself, see the examples below).


Description

The textfilter( function scans the text using a formula you supply. The function evaluates the formula over and over again until the scan is complete. Unlike the characterfilter( function, which scans each character separately, the textfilter( function allows the formula to process multiple characters with each pass of the formula. The formula returns two values – how many characters it has scanned, and the text produced. It returns two values in the form of a dictionary with two entries, SKIP and APPEND. The SKIP entry must contain the number of characters scanned, while the APPEND entry contains the text produced by this section of the scan (this can be 1 character, multiple characters, or no characters).

Here is a simple example of this function:

textfilter("abcd",{initializedictionary("SKIP",1,"APPEND",upperword(import()))}) ☞ AbcdBcdCdD

Note: Panorama 6 and earlier versions of Panorama had a textfilter statement that was similar to this function. However, that statement combined binary data with text, which cannot be done in the Unicode system Panorama X uses. Because of this, the new textfilter( function uses a dictionary instead of combining data and text into a single value. Legacy programs that use the textfilter statement will have to be modified to work with the textfilter( function.


Error Messages

textfilter( syntax error in filter formula – This error will occur if the filter formula itself contains a syntax error.


See Also


History

VersionStatusNotes
10.0NewNew in this version.