$ZWIDTH; $ZWIDTH
Returns the total width of characters in an expression.
The outline
$ZWIDTH(expression,pitch)
Copy the code
parameter
- Expression String expression
- Pitch Optional – Numeric pitch value for full-corner characters. The default value is 2. The other allowable values are 1, 1.25, and 1.5. (These values are allowed to have any number of trailing zeros.) . All other spacing values cause errors.
describe
$ZWIDTH returns the total width of the characters in the expression. The spacing value determines the width to be used for full-corner characters. All other characters are specified as 1 in width and are treated as half corners.
$ZWIDTH is only available in the Unicode version of Cache.
Note: in DSM-J mode, $ZWIDTH can be abbreviated to $ZW. This abbreviation cannot be used in Cache mode.
The sample
Suppose the variable STR contains two half-corner characters followed by a full-corner character:
WRITE $ZWIDTH(STR,1.5)
Copy the code
In this case, the sum of the two half-corner characters is 2. The sum of full-corner characters is 1.5(the specified spacing value) and the sum is 3.5.
Pay attention to
Full-corner characters are determined by examining the pattern matching table loaded for the Cache process. Any character with a full-angle attribute is treated as a full-angle character. You can use the special ZFWCHARZ patcode to check this property (char? 1 zfwcharz).