Is there an easy way to truncate strings to a certain width in Racket?
Examples:
(truncate "foobar" 3)
-> "foo"
(truncate "foobar" 6)
-> "foobar"
I'd also like to replace the last few characters of a truncated string:
(truncate "foobar" 4 #:when-truncated "...")
-> "f..."
(truncate "foobar" 10 #:when-truncated "...")
-> "foobar"