Lexical operator for editing text strings. Format %EDIT (string1,string2)
1 – Arguments
string1 The first argument, of type string, specifies the string to be edited. string2 The second argument, of type string, specifies a list of edits to perform, which are separated by commas.
2 – Description
%EDIT is modeled after the OpenVMS DCL lexical function F$EDIT. It is used to perform one or more edits on a specified string. %EDIT processes the string of arguments from left to right. %EDIT gives precedence to the last argument. %EDIT gives precedence to uppercase over lowercase. The list of edits may contain any combination of the following elements: Element Function COLLAPSE Removes all tabs and spaces. COMPRESS Replaces multiple, consecutive tabs or spaces with a single space. LOWERCASE Changes uppercase characters to lowercase. TRIM Removes leading and trailing spaces and tabs. UPCASE Changes lowercase characters to uppercase.
3 – Examples
Example 1 .PRINT "%EDIT(< Fred Smith >, <TRIM,COLLAPSE,UPCASE>)" After lexical processing, the statement apears as the following: .PRINT "FREDSMITH" Example 2 .PRINT "%EDIT(<AbCdEfG>,<upcase,lowercase>) .PRINT "%EDIT(<AbCdEfG>,<lowercase,upcase>) The first source statement produces the string "abcdefg" and the second source statement produces the string "ABCDEFG". Each of the edits in the edit list is performed in sequence, from left to right.