fractionString()

Synopsis

Returns a string representation of value in "Architectural" form, using feet and inches notation similar to AutoCAD's Architectural units format. A series of optional arguments allow control over many of the forms of the output.

The optional arguments often interact with each other, and result in behavior which may not actually agree with the settings provided, especially the defaults. For example, feetToo? being false effectively prevents suppressUnits? false from having an effect on the output. This is because there is usually little need to include unit designators when all units are in inches.

Syntax

fractionString ( value As Number, _
                  Optional maxDenominator As Integer = 16, _
                  Optional feetToo? As Boolean = True, _
                  Optional suppressUnits? As Boolean = True, _
                  Optional fractionHyphen? As Boolean = False, _
                  Optional feetInchHyphen? As Boolean = True, _
                  Optional hideZeroInches? As Boolean = _
                   (Not feetToo?) Or (abs(value) < (1 - (1 / MaxDenominator / 2))), _
                  Optional hideZeroFeet? As Boolean = True ) As String
Argument Type Description
value Number The value to be converted to a fractional string.
maxDenominator Integer Optional; the maximum denominator permitted in fractions of an inch in the output. The value is rounded to the nearest fraction of this size before being formatted. Default is 16.
feetToo? Boolean Optional; determines whether the output should include the feet. If false, only inches are included. Default is True.
suppressUnits? Boolean Optional; determines whether the unit designator(s) should be included; default is True.
fractionHyphen? Boolean Optional; determines whether the fractional inches part should include a hyphen between the whole inches and the fraction. Default is False .
feetInchHyphen? Boolean Optional; determines whether there should be a hyphen between the feet and inches values; default is True.
hideZeroInches? Boolean Optional; determines whether a zero value for whole inches should be included.
hideZeroFeet? Boolean Optional; determines whether a zero value for feet should be included; default is True. The default behavior is to not include any zero foot values, which also acts as if hideZeroInches? is true.

Example 1

Intent >fractionString(24.375) 
--> "2'-0 3/8"" 
Note that even when suppressUnits? is defaulting to True , the units are shown in the basic case.

Example 2

Intent >fractionString(24.375, maxDenominator := 4)  
--> "2'-0 1/2"" 
Note that 3/8 is rounded to the nearest 1/4 inch. suppressUnits? continues to be ignored.

Example 3

Intent >fractionString(24.375, feetToo? := false) 
--> "24 3/8" 
Note that the units are dropped.

Example 4

Intent >fractionString(24.375, fractionHyphen? := true) 
--> "2'-0-3/8""
Same as default, except for the fraction hyphen.

Example 5

Intent >fractionString(24.375, feetInchHyphen? := false) 
--> "2' 0 3/8"" 
Same as default, now without the hyphen.

Example 6

Intent >fractionString(24.375, hideZeroInches? := true) 
--> "2'-3/8"" 
Same as default, but without the zero.

Example 7

Intent >fractionString(0.375, hideZeroFeet? := false) 
--> "0'-3/8"" 
The default behavior is to not include any zero foot values, which also acts as if hideZeroInches? is true.