String reboot - (1a) incidental whitespace
Guy Steele
guy.steele at oracle.com
Fri Apr 19 01:23:56 UTC 2019
> On Apr 18, 2019, at 7:55 PM, John Rose <john.r.rose at oracle.com> wrote:
> . . .
> Also, is a left-margin quote allowed immediately before the
> close-quote? Is it required? If allowed and not required,
> this basically means such a string can end with either three
> or four close-quotes.
I would say “not allowed”.
> On Apr 18, 2019, at 8:29 PM, John Rose <john.r.rose at oracle.com> wrote:
> . . .
> This puts the burden back on the uncommon stripping
> case. We might want a way to say "delete that last newline,
> even though I used it to make my pretty box". One way
> to do this would be a new escape sequence for ML strings
> only:
>
> String message = """
> hello
> world\
> "”";
Consider an escape sequence (I’ll use \@ as the example) that has the property that it contributes nothing to the content of the string, and furthermore cancels all non-escapewhitespace (including newlines) on both sides.
To strip the last newline:
String message = """
hello
world
\@""";
To omit all newlines and just run lines together with one space in between:
String message = """
\@\ hello
\@\ world
\@""";
To omit all newlines and just run lines together with one space in between and one newline at the end:
String message = """
\@\ hello
\@\ world
\@\n""";
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.java.net/pipermail/amber-spec-experts/attachments/20190418/fabf158f/attachment.html>
More information about the amber-spec-experts
mailing list