VMS Help
Lexicals, F$EDIT

 *Conan The Librarian (sorry for the slow response - running on an old VAX)

    Edits the character string based on the edits specified in the
    edit-list argument.

    Format

      F$EDIT(string, edit-list)

  1 - Return Value

    A character string containing the specified edits.

  2 - Arguments

 string

    Specifies a character string to be edited. Quoted sections of the
    string are not edited.

 edit-list

    Specifies a character string containing one or more of the
    following keywords that specify the types of edits to be made
    to the string:

    Edit          Action

    COLLAPSE      Removes all spaces or tabs.
    COMPRESS      Replaces multiple spaces or tabs with a single
                  space.
    LOWERCASE     Changes all uppercase characters to lowercase.
    TRIM          Removes leading and trailing spaces or tabs.
    UNCOMMENT     Removes comments.
    UPCASE        Changes all lowercase characters to uppercase.

    If you specify more than one keyword, separate them with commas
    (,).  Do not abbreviate these keywords.

    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.

                                   NOTE

       When UPCASE is specified with LOWERCASE in an edit-list,
       UPCASE takes precedence.

  3 - Examples

    1.$ LINE = "   THIS   LINE   CONTAINS A ""  QUOTED  "" WORD"
      $ SHOW SYMBOL LINE
        LINE =  "    THIS    LINE    CONTAINS A "  QUOTED  " WORD"
      $ NEW_LINE = F$EDIT(LINE, "COMPRESS, TRIM")
      $ SHOW SYMBOL NEW_LINE
        NEW_LINE = "THIS LINE CONTAINS A "  QUOTED  " WORD"

      This example uses the F$EDIT function to compress and trim a
      string by replacing multiple blanks with a single blank, and by
      removing leading and trailing blanks. The string LINE contains
      quotation marks around the word QUOTED. (To enter quotation
      marks into a character string, use double quotation marks in
      the assignment statement.)

      Note that the F$EDIT function does not compress the spaces in
      the quoted section of the string; therefore, the spaces are
      retained around the word QUOTED.

    2.$ LOOP:
      $      READ/END_OF_FILE = DONE INPUT_FILE RECORD
      $      RECORD = F$EDIT(RECORD, "TRIM, UPCASE")
      $      WRITE OUTPUT_FILE RECORD
      $      GOTO LOOP
         .
         .
         .

      This example sets up a loop to read records from a file, to
      edit them, and to write them to an output file. The edited
      records have leading and trailing blanks removed, and are
      converted to uppercase.

    3.$ UNCOMMENT_LINE = F$EDIT("$ DIR ! THIS IS THE COMMENT", "UNCOMMENT")
      $ SHOW SYMBOL UNCOMMENT_LINE
      $ UNCOMMENT_LINE = "$ DIR"

      This example uses the F$EDIT function to remove comments.
  Close     HLB-list     TLB-list     Help  

[legal] [privacy] [GNU] [policy] [netiquette] [sponsors] [FAQ]
Tweet
Polarhome, production since 1999.
Member of Polarhome portal.