commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Benedikt Ritter <brit...@apache.org>
Subject [LANG] Feature request: Custom word boundary separators for WordUtils.wrap
Date Wed, 09 Jul 2014 05:45:27 GMT
Hello Andrew,

we use jira for tracking new ideas / feature requests [1]. Chances that
this will be implemented are even higher if you provide a patch with
acompanying unit tests ;-)

Currently I'm not sure whether this really belongs to lang. WordUtils is
supposed as a utility for simple use cases. We should make sure that it
doesn't become a full blown text parsing engine, since would be out of
scope for [LANG] imho.

br,
Benedikt

[1] https://issues.apache.org/jira/browse/LANG


2014-07-08 20:45 GMT+02:00 Andrew Pennebaker <andrew.pennebaker@gmail.com>:

> The current implementation of WordUtils.wrap behaves well for a lot of
> basic English language text, but I'd really like to word-wrap more
> complicated text, that contains hyphens and other punctuation. I want to be
> able to supply a dash, slash separator ("-/") to wrap so that
> "tomato-potato" wraps like:
>
> tomato-
> potato
>
> and "flammable/inflammable" wraps like:
>
> flammable/
> inflammable
>
> Currently, WordUtils.wrap does not appear to have an option for customizing
> word boundary separators, so these examples end up getting wrapped like:
>
> tomato-potato (with wrapLongWords false)
>
> flammable/inflammable
>
> When wrapLongWords is set to true, the current space-based wrapping is
> almost unreadable:
>
> tomato-po
> tato
>
> flamm
> able/inf
> lamma
> ble
>
> --
> Cheers,
>
> Andrew Pennebaker
> www.yellosoft.us
>



-- 
http://people.apache.org/~britter/
http://www.systemoutprintln.de/
http://twitter.com/BenediktRitter
http://github.com/britter

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message