Unicode - Perform Unicode - Integer Conversions
result = Unicode ( arg ) |
result | The result of the operation, dependent on the arguments. | |
arg | Either a string, integer or list. |
This module converts a string to its Unicode representation or converts one or more integers into a string of Unicode characters. If the argument is a single character string then its Unicode integer equivalent is return. If the argument is a multi-character string then a list of integers is returned. If the argument is an integer then an single character string is returned. If the argument is a list of integers then a string representing those integers is returned.
Unicode("a") | returns 97 | |
Unicode(97) | returns "a" | |
Unicode("abcDEF") | returns the list (97 98 99 68 69 70) | |
Unicode((97 98 99 68 69 70)) | returns "abcDEF" |
UOM - Perform Various Units of Measure Operations
result = UOM ( uom tagarg ) |
result | The result of the UOM operation. | |
uom | A unit of measure specification. | |
tagarg | One or more of the tagged arguments below. |
Acceptor::name | The name of the UOM entry to be the default acceptor (input) unit of measure. | |
CoMingle::logical | If logical is TRUE then entries within a UOM can be added to other UOMs, if FALSE (default) then they may not. | |
Count::num | Specifies the case-count for the current UOM entry. | |
Description::string | Specifies the description of the current UOM entry. | |
Displayer::uomid | The name of the UOM entry to be used as the default display UOM. Use the string AsIs to have UOM entries display in current UOM. | |
Factor::num | The conversion factor off of the base for the current UOM. | |
Format::logical | If TRUE then use the prefix/suffix when displaying a UOM. | |
Id::uomid | Specifies the UOM string identifier or internal number to specify a particular entry within a UOM. | |
Index::num | Specifies the next UOM index number for the current UOM. | |
Label::string | Specifies the prefix/suffix character string for the current UOM entry. | |
Name::string | Specifies the name of the current UOM entry. | |
Num::num | Sets the numeric portion of a UOM to num (in base units). If the first argument is a UOMPer then the price portion is set to num. | |
Partial::logical | If logical is TRUE then fractional UOM entries are allowed. If FALSE (default) then only integral amounts are accepted. | |
Round::decimals | The number of decimal places to keep for the current UOM. | |
Type::point | Defines the user defined point type for the current UOM. |
Description? | Returns the description associated with a UOM table. | |
Factor? | Return the conversion factor of the current UOM entry. | |
Format? | Returns TRUE or FALSE depending on whether or not a UOM utilizes a prefix/suffix string. | |
Head? | Returns the price portion of a UOMPer point or the first UOM of a UOMperUOM point. | |
Id? | Return the UOM entry name of the current UOM. | |
Index? | Return the unit-of-measure table internal index of the current UOM entry. | |
Label? | Return the label of the current UOM entry. | |
Num? | Return the numeric quantity of the current UOM entry. This quantity is always in base units. | |
Reset? | Resets the entire internal UOM table or if a UOM table is given as the first argument then just that UOM. | |
Round? | Return the rounding of the current UOM entry. | |
Tail? | If this is the last argument then it returns the UOM portion of a UOMPer point or the second UOM of a UOMperUOM point. If it is not the last argument then the UOM portion (or second UOM) is taken and module processing continues. | |
Type? | Returns the type point associated with a UOM table. |
V4 supports a powerful units-of-measure facility. Any number of different units-of-measure tables may be defined. Each table describes its own various measures and how they interrelate. For instance a linear table may describe units in inches, feet, yards, centimeter, and meters. A volume table may describe quarts, pints, liters, and gallons. Different units may be differentiated with unique prefixes or suffixes.
Each units-of-measure table must be defined before any entries or operations on that table are performed. The tags to define tables include Id, Acceptor, and Displayer. The tags to define entries within a table include Id (to define the table), Index (to define the entry), Factor (to define the conversion factor) and Label to define a prefix or suffix.
The definition of a UOM table is usually done automatically by the V4 runtime. The first time any reference is made to a UOM entry, V4 attempts to initialize that UOM's table by evaluating the binding [UV4:UOMInitialize Int:n] where n is the UOM table's Id. See the example below.
The UOMPer point type is a combination of a real number and a unit of measure. It is most often used to define a price or amount per a unit of measure (e.g. 3.95 per 6oz.).
Many arithmetic operations are allowed on UOM and UOMPer points. For example '{UOM1:1lb * PPer:2.00/1oz}' would evaluate properly to Num:32.00
UOM Coercion ....
Example 55 - Initializing a UOM Table
[UV4:UOMInitialize] Do(Echo("Init UOM!") UOM(Id::1 Index::1 Factor::1 Label::"ea" Partial::1) UOM(Id::1 Index::2 Factor::12 Label::"dz") UOM(Id::1 Acceptor::"ea" Displayer::ASIS) ) |