Difference between revisions of "F$EDIT()"

From VSI OpenVMS Wiki
Jump to: navigation, search
(Created page with "'''F$EDIT()''' is a lexical function that edits the character string: removes spaces, tabs, and comments, and changes lowercase characters to uppercase a...")
 
 
Line 38: Line 38:
 
   B = "  HELLO    "Bob!" THIS IS JOHN.  "
 
   B = "  HELLO    "Bob!" THIS IS JOHN.  "
 
  </nowiki>
 
  </nowiki>
 +
 +
[[Category: Lexical Functions]]

Latest revision as of 05:45, 15 January 2019

F$EDIT() is a lexical function that edits the character string: removes spaces, tabs, and comments, and changes lowercase characters to uppercase and vice versa.

Format

F$EDIT(string, edit-list) String is the string to be edited. Edit list consists of one or more of the keywords below separated by commas.

Keywords

Keyword Action Example
COLLAPSE Removes all spaces or tabs " Hello Bob! This is John. "

-> "HelloBob!ThisisJohn."

COMPRESS Replaces multiple spaces or tabs with a single space " Hello Bob! This is John. "

-> " Hello Bob! This is John. "

LOWERCASE Changes all uppercase characters to lowercase. " Hello Bob! This is John. "

-> " hello bob! this is john. "

TRIM Removes leading and trailing spaces or tabs. " Hello Bob! This is John. "

-> "Hello Bob! This is John."

UNCOMMENT Removes comments. " Hello Bob! This is John. "

-> " Hello Bob"

UPCASE Changes all lowercase characters to uppercase. " Hello Bob! This is John. "

-> " HELLO BOB! THIS IS JOHN. "

Note that edits are not applied to quoted sections of strings; therefore, if a string contains quotation marks (" "), the characters within the quotation marks are not affected by the edits specified in the edit list:

$ a = "  Hello    ""Bob!"" This is John.  "
$ b = f$edit(a,"UPCASE")
$ show sym b
  B = "  HELLO    "Bob!" THIS IS JOHN.  "