F$EDIT()

From VSI OpenVMS Wiki
Revision as of 05:45, 15 January 2019 by Darya.zelenina (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

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.  "