Skip to content

More dynamic f-interpolator with interpolated formatting directives #17709

@som-snytt

Description

@som-snytt

A frequent need:

val prefix = String.format(s"%${offset - 2}s |", lineNbr)

written as

f"$lineNbr%${offset - 2}s |"

At compile time, it's only necessary to verify that the interpolation in the formatting directive is an int.

Perhaps other interpolated directives would be tricky to verify and might be rejected.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions