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

Programmer's Guide to Text Blocks discussion of \s and \<line-terminator>

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Delivered
    • Icon: P4 P4
    • None
    • None
    • docs
    • None

      My colleague Chris Povirk noticed some issues with the documentation in Programmer's Guide to Text Blocks ( https://docs.oracle.com/en/java/javase/23/text-blocks/index.html )

      In the guide, the 'New Escape Sequences' section suggests using \s for including trailing whitespace and using \<line-terminator> for excluding the final newline.

      The 'That Final New Line' section doesn't mention \<line-terminator>, and instead shows putting the closing delimiter on the last line.

      The 'Trailing White Space' section doesn't mention \s.

      I wonder if those sections were originally written before the new escapes were added? I think it would be helpful to update them to mention or recommend the preferred solutions of \<line-terminator> and \s.

      Also, the page lists of the escape sequences translateEscapes processes, but omits \s, unlike the method's javadoc: https://docs.oracle.com/en/java/javase/23/docs/api/java.base/java/lang/String.html#translateEscapes()

      One more note is that the links in the table of contents are broken, they appear to link to a staging version of the page: http://docweb2.s4.javaplatfo1phx.oraclevcn.com/~rgallard/orahub-sedocs/sedocs/jdk/text-blocks/index.html#introduction

            rgallard Raymond Gallardo
            cushon Liam Miller-Cushon
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: