Uploaded image for project: 'Commons Lang'
  1. Commons Lang
  2. LANG-1023

Add WordUtils.wrap overload with customizable breakable character

    XMLWordPrintableJSON

Details

    Description

      WordUtils.wrap is good at what it does, but I want slightly different semantics. I would like the option to set different characters for word breaking, not just space or whitespace, but punctuation marks.

      The current implementation wraps like this:

      flammable/inflammable [original string]

      flammable/inflammable [wrap with large widths]

      flammable/inflammable [wrap with wrapLongWords = false]

      flammable/inflam [wrap with wrapLongWords = true]
      mable

      I would like to configure wrap to break "flammable/inflammable" on punctuation marks as well as whitespace, so that it wraps like this:

      flammable/ [wrap with additionalBreakCharacters = "/+-"]
      inflammable

      Attachments

        Issue Links

          Activity

            People

              britter Benedikt Ritter
              mcandre Andrew Pennebaker
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: