I would like to be able to wrap a long String to a fixed length. Is there a way to do that in Guava?
Apache Commons / Lang has the method WordUtils.wrap(String, length) that does exactly what I need. Does Guava have a simple means to accomplish this?
I know I can do a hard wrap using Splitter.fixedLength(int), but I would like a soft wrap.
UPDATE: There is now a bounty for this question.
Obviously this functionality isn’t available in Guava out of the Box, so the bounty goes to the most concise (or most complete) and Guava-like answer that uses what’s there in Guava. No libs except Guava allowed.
We (Guava) strongly recommend you use ICU4J’s
BreakIteratorclass to handle the mechanics of finding break points in user text.