docs.intersystems.com
InterSystems IRIS Data Platform 2019.2  /  ObjectScript Reference

ObjectScript Reference
$ZWIDTH
Previous section           Next section
InterSystems: The power behind what matters   
Search:  


Returns the total width of the characters in an expression.
Synopsis
$ZWIDTH(expression,pitch)
Parameters
expression A string expression
pitch Optional — The numeric pitch value to use for full-width characters. The default is 2. Other permissible values are 1, 1.25, and 1.5. (These values with any number of trailing zeros are permissible.) All other pitch values result in a <FUNCTION> error.
Description
$ZWIDTH returns the total width of the characters in expression. The pitch value determines the width to use for full-width characters. All other characters are assigned a width of 1 and are considered to be half-width.
Example
Assume that the variable STR contains two half-width characters followed by a full-width character:
   WRITE $ZWIDTH(STR,1.5)
returns 3.5.
In this example, the two half-width characters total 2. Adding 1.5 (the specified pitch value) for the full-width characters produces a total of 3.5.
Note
Full-width characters are determined by examining the pattern-match table loaded for your InterSystems IRIS process. Any character with the full-width attribute is considered to be a full-width character. You can use the special ZFWCHARZ patcode to check for this attribute (char?1ZFWCHARZ). For more information about the full-width attribute, see the description of the $X/$Y Tab in the section on “System Classes for National Language Support” in Specialized System Tools and Utilities.
See Also


Previous section           Next section
Send us comments on this page
View this book as PDF   |  Download all PDFs
Copyright © 1997-2019 InterSystems Corporation, Cambridge, MA
Content Date/Time: 2019-08-22 06:48:58