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

Function to replace multiple whitespaces by a character and trim

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Major
    • Resolution: Workaround
    • None
    • None
    • lang.*
    • None

    Description

      In form applications where user can input data its very often not wished to have successive whitespace characters.

      A function that will replace multiple whitespace characters with a single space (or passed string/character) would be a nice feature since I myself repeat this method in many applications.

      Something like a shortcut for:

      value.replace("
      s+", " ").trim()

      Attachments

        Activity

          People

            dmjones500 Duncan Jones
            djmj Marco Janc
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: