OpenersNotesSection(Spacer1)Details

OpenersPrimaryExamplesSection(Spacer1)Examples  (3)

OpenersExampleSection0(Spacer1)Basic Examples  (3)

Interpret percentages:

Interpreter["PercentFraction"]["20%"]

Interpreter["PercentFraction"]["5 percent"]

If no unit is provided, convert the number to a percentage:

Interpreter["PercentFraction"]["1"]

Interpreter["PercentFraction"][".5"]

Interpreter["PercentFraction"]["7/5"]

Interpreter["PercentFraction"]["2.5"]

Cf. (StringTypeLink["Percent", paclet:ref/interpreter/Percent]), which simply infers a percent unit:

Interpreter["Percent"]["2.5"]

And (StringTypeLink["HeuristicPercent", paclet:ref/interpreter/HeuristicPercent]), which decides what to do based on heuristics:

Interpreter["HeuristicPercent"][".5"]

Interpreter["HeuristicPercent"]["2.5"]

Interpret quantities or numbers as fractions of the given baseline:

Interpreter[Restricted["PercentFraction", Quantity[5,"Pounds"]]]["3 ounces"]

Interpreter[Restricted["PercentFraction", 2]]["1.5"]

({{DocumentationFooterIconsRelatedFunction.png, ({{See Also}, {(RefLink[Interpreter, paclet:ref/Interpreter])  ▪  (RefLink[SemanticImport, paclet:ref/SemanticImport])  ▪  (RefLink[Restricted, paclet:ref/Restricted])  ▪  (RefLink[Failure, paclet:ref/Failure])}, {Related Interpreter Types:  (RefLink[ComputedPercentFraction, paclet:ref/interpreter/ComputedPercentFraction])  ▪  (RefLink[Quantity, paclet:ref/interpreter/Quantity])  ▪  (RefLink[Percent, paclet:ref/interpreter/Percent])  ▪  (RefLink[HeuristicPercent, paclet:ref/interpreter/HeuristicPercent])  ▪  (RefLink[StructuredQuantity, paclet:ref/interpreter/StructuredQuantity])  ▪  (RefLink[ComputedQuantity, paclet:ref/interpreter/ComputedQuantity])  ▪  (RefLink[ComputedPercent, paclet:ref/interpreter/ComputedPercent])  ▪  (RefLink[ComputedHeuristicPercent, paclet:ref/interpreter/ComputedHeuristicPercent])}})}})

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