VMS Help  —  Lexicals  F$EDIT  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 Help