$scale (parse-spec, fmultiplier, foffset) function
Scale the parsed value specified by the first argument by multiplying the value with the fmultiplier floating point number of the second argument and then adding the foffset floating point number of the third argument. All three arguments are required. The result is an integer number rounded down to the nearest integer value.
Target string | Parse expression | Return value |
|---|---|---|
N1: 2000 | $scale( n1: *, 0.5, 0) | 1000 The parsed value is multiplied by 0.5, that is, is divided by two. |
P1: 20KB | $scale( p1: *, 10, -50) | 150 The parse value (not including KB units) is multiplied by 10 and then 50 is subtracted. |
Q1: 24.999
| $scale( Q1: *, 2, 0) | 49 The parse value is parsed as a floating point number, multiplied by two, then rounded down to the nearest integer |
R1: Test | $scale(r1: *, 1, 0) | No match. The parsed value is not an integer number. |
Related topic