From VSI OpenVMS Wiki
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.


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.


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


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