メインコンテンツまでスキップ
バージョン:25.4

splitUnits

Function

Converts a numeric value of a certain unit type into a specified list of units that add up to the original value. For example, convert a weight into pounds and ounces, or a duration into hours, minutes, and seconds.

This function cycles through the requested unit names in order, and allocates the whole number of each of those units in turn from the original value. The final unit in the list receives the remaining part of the value, including any fractional part.

Example:

put splitUnits(4288.321 seconds, ["hrs","mins","secs",empty]) --> [1 hour,11 minutes,28 seconds] // Use 'empty' to absorb any amount that is smaller than the final unit type
put splitUnits(4288.321 seconds, "hrs", "mins", "secs") --> [1 hour,11 minutes,28.321 seconds]

Further Reading

Resources in our other reference manuals.

Related terms in the SenseTalk Dictionary.