|
A function that can be used in Formulas.
truncateRight$
(string$
, maximumNewWidth
)
string$
until the result is at least as short as maximumNewWidth
: assert truncateRight$ ("hello", 3) = "hel"
assert truncateRight$ ("hello", 5) = "hello"
No padding takes place, so the resulting string may be shorter than maximumNewWidth
:
assert truncateRight$ ("hello", 12) = "hello"
Note that maximumNewWidth
cannot be negative:
asserterror Can never truncate a string down to -3 characters.
a$ = truncateRight$ ("hello", -3)
© Paul Boersma 2024