Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-7190385

(str) Provide additional trim method(s) that is(are) more intelligent about whitespace

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Unresolved
    • Icon: P4 P4
    • tbd
    • None
    • core-libs
    • None
    • generic
    • generic

      See CR 4080617. In addition, see the blog entry, http://closingbraces.net/2008/11/11/javastringtrim/

      In short, trim() has very limited capabilities and strips off far more (or less) than is desirable. To quote the blogger, Mike Kaufman --

      "The String.trim() method talks about “whitespace”, but defines this in a very precise but rather crude and idiosyncratic way – it simply regards anything up to and including U+0020 (the usual space character) as whitespace, and anything above that as non-whitespace.

      This results in it trimming the U+0020 space character and all “control code” characters below U+0020 (including the U+0009 tab character), but not the control codes or Unicode space characters that are above that."

      This RFE is to implement one (or more) additional "trim" methods that are smarter about what is trimmed. In addition to what is suggested by Mr. Kaufman, we might consider a user-definable trim-set of characters.

            Unassigned Unassigned
            jgish Jim Gish (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Imported:
              Indexed: