Logo GenPRES

Api Module

Evaluates text with ValueUnits and operators to one ValueUnit and converts the text of a ValueUnit to another unit.

Functions and values

Function or value Description

convert loc verb s2 s1

Full Usage: convert loc verb s2 s1

Parameters:
    loc : Localization - The locale to use for the conversion
    verb : Verbal - The verb to use for the conversion
    s2 : string - The string representing the unit to convert to
    s1 : string - The string to convert

Returns: string

Converts a string representing a ValueUnit to another ValueUnit

loc : Localization

The locale to use for the conversion

verb : Verbal

The verb to use for the conversion

s2 : string

The string representing the unit to convert to

s1 : string

The string to convert

Returns: string

eval s

Full Usage: eval s

Parameters:
    s : string - The string to convert

Returns: ValueUnit

Evaluates a string to a ValueUnit

s : string

The string to convert

Returns: ValueUnit
Example

 "1.2 mg" |> Api.eval
 // returns ValueUnit ([|6/5N|], Mass (MilliGram 1N))

 "20 mg/50 ml" |> Api.eval
 // returns ValueUnit ([|2/5N|], Concentration (Mass (MilliGram 1N), Volume (MilliLiter 1N)))

Type something to start searching.