Skip to content

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

@scabug

Description

@scabug

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

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.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions