CLIPPED

CLIPPED operator takes a character operand and returns the same character value, but without any following spaces.

CLIPPED operator can be useful in these situations:

CLIPPED operator might affect the value of a character variable within an expression.

CLIPPED does not affect the value when it is stored in a variable (unless you are concatenating CLIPPED values together).

Relative to other 4gl operators, CLIPPED has a very low precedence. This can lead to confusion in some contexts (e.g., when you specify compound Boolean conditions).

For example, qfgl parses this condition:

IF LENGTH(f1) > 0 AND f1 CLIPPED != "first_name" THEN

as if it were delimited with parentheses as:

IF (((LENGTH(f1) > 0) AND f1) CLIPPED) != "first_name" THEN

To get the required result, you can write the expression as:

IF LENGTH(f1) > 0 AND (f1 CLIPPED) != " first_name " THEN

Character expressions often have a data length smaller than their total size.

In this example program, the DISPLAY statement produces an output that would have included 40 trailing blanks if CLIPPED were omitted but displays only 22 characters when CLIPPED is included:

MAIN

  DEFINE my_string CHAR(60)

  LET my_string = "Test string char(60)"

  DISPLAY "QX chars added to the end" at 5,5

  DISPLAY "of unclipped string:" at 6,5

  DISPLAY my_string, 'QX' at 8,5

  DISPLAY "QX chars added to the end" at 10,5

  DISPLAY "of clipped string:" at 11,5

  DISPLAY my_string CLIPPED, 'QX' at 13,5

  CALL fgl_getkey()

END MAIN

 

 

Contact Us

Privacy Policy

Copyright © 2024 Querix, (UK) Ltd.