Scala Programming Language
  1. Scala Programming Language
  2. SI-6725

f string interpolator does not support %n (platform line separator) specifier

    Details

      Description

      scala> val a = 1; val s =f"$a%s%n$a%s"
      a: Int = 1
      s: String = 1%n1

      The ScalaDoc for the f interpolator states, "All specifiers allowed in Java format strings are handled, and in the same way they are treated in Java," but when read in context, format specifiers are only supported when in a formatting position. It would be useful if %n was supported directly. As it stands, an additional call to .format() is needed to insert a platform specific line separator.

        Activity

        Show
        Eugene Burmako added a comment - https://github.com/scala/scala/pull/2222

          People

          • Assignee:
            Eugene Burmako
            Reporter:
            Michael Pilquist
          • Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development