Simple way to truncate a string in Clojure

Viewed 4044

I have a string that must be truncated at 200 characters if it is too long.

Checking the cheatsheet, (subs "Lorem Ipsum" 0 200) would seem to be an obvious choice, but it throws an exception if the second operator is greater than the length of the string.

Is there a simple, built-in function for truncating a string in Clojure? What's the simplest way to do this if I have to define my own?

2 Answers
Related