OpenersNotesSection(Spacer1)Details

OpenersPrimaryExamplesSection(Spacer1)Examples  (3)

OpenersExampleSection0(Spacer1)Basic Examples  (3)

Interpret quantities:

Interpreter["StructuredQuantity"]["1.5 Hours"]

Interpreter["StructuredQuantity"]["4.5e2 Meters"]

Restrict and convert to a unit:

Interpreter[Restricted["StructuredQuantity", "Kilograms"]]["10 Ounces"]

Accept unitless inputs in the presence of an appropriate restriction:

Interpreter[Restricted["StructuredQuantity", QuantityVariable["Money"]]]["100"]

Interpreter[Restricted["StructuredQuantity", "Hours"]]["5.4"]

No connection to the Wolfram Cloud is attempted. Only canonical units (as found in the (RefLink[InputForm, paclet:ref/InputForm])) can be used:

Interpreter["StructuredQuantity"]["2 hr"]

For currency units, the unit conversion is kept symbolical to avoid connecting to the Wolfram Cloud to get the exchange rate:

Interpreter[Restricted["StructuredQuantity","USDollars"]]["12 Euros"]

Restrict in an interval:

Interpreter[Restricted["StructuredQuantity", "Kilometers",{1,100}]]["20 Miles"]

Set the precision:

Interpreter[Restricted["StructuredQuantity", Automatic,Automatic,3]]["1.2345 Seconds"]

Change the number separator:

Interpreter["StructuredQuantity",NumberSeparator->","]["18,726 Meters"]

({{DocumentationFooterIconsRelatedFunction.png, ({{See Also}, {(RefLink[Quantity, paclet:ref/Quantity])  ▪  (RefLink[QuantityVariable, paclet:ref/QuantityVariable])  ▪  (RefLink[QuantityVariablePhysicalQuantity, paclet:ref/QuantityVariablePhysicalQuantity])  ▪  (RefLink[QuantityVariableCanonicalUnit, paclet:ref/QuantityVariableCanonicalUnit])  ▪  (RefLink[Interpreter, paclet:ref/Interpreter])  ▪  (RefLink[Restricted, paclet:ref/Restricted])  ▪  (RefLink[Failure, paclet:ref/Failure])  ▪  (RefLink[UnitConvert, paclet:ref/UnitConvert])}, {Related Interpreter Types:  (RefLink[Quantity, paclet:ref/interpreter/Quantity])  ▪  (RefLink[ComputedQuantity, paclet:ref/interpreter/ComputedQuantity])  ▪  (RefLink[PhysicalQuantity, paclet:ref/interpreter/PhysicalQuantity])  ▪  (RefLink[CurrencyAmount, paclet:ref/interpreter/CurrencyAmount])  ▪  (RefLink[CurrencyName, paclet:ref/interpreter/CurrencyName])  ▪  (RefLink[ComputedCurrencyAmount, paclet:ref/interpreter/ComputedCurrencyAmount])}})}})

({{DocumentationFooterIconsRelatedGuide.png, ({{Related Guides}, {▪(RefLinkPlain[Setting Up Input Interpreters, paclet:guide/InterpretingStrings])}})}})