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