- trim <width> <format> ...procedure
- trim/left <width> <format> ...procedure
- trim/both <width> <format> ...procedure
Analogs of SRFI-13 string-trim, truncates the output of the <format>s to force it in under <width> columns. As soon as any of the <format>s exceed <width>, stop formatting and truncate the result, returning control to whoever called trim. If <width> is not exceeded has no effect.
If a truncation ellipse is set (e.g. with the ellipses procedure below), then when any truncation occurs trim and trim/left will append and prepend the ellipse, respectively. trim/both will both prepend and append. The length of the ellipse will be considered when truncating the original string, so that the total width will never be longer than <width>.
(fmt #f (ellipses "..." (trim 5 "abcde"))) => "abcde" (fmt #f (ellipses "..." (trim 5 "abcdef"))) => "ab..."