[swift-evolution] multi-line string literals.
rparada at mac.com
Wed May 11 21:48:40 CDT 2016
On May 11, 2016, at 2:34 PM, Vladimir.S <svabox at gmail.com> wrote:
>> For example:
>> letsourceCode =@“NSString *firstName = @“John”;
>> "NSString *lastName = @“Doe”;
>> “NSString *fullName = [NSString stringWithFormat: @“%@
>> %@“, firstName, lastName];"@
>> The one that would be a bit of a problem is the closing delimiter,
> Yes.. this is why I asked about `"@` - closing delimiter
> so.. what is the solution in your case ?
I don't really have a solution. Perhaps escaping the closing delimiter like this \"@
It is not pretty but I can't think of anything else. I imagine the other alternatives, i.e. the triple quote `"""` and the quote plus underscore `"_ ` have the same problem.
If we make the continuation quote required then we don't need a closing delimiter. That would solve the problem. But I've seen several people say they don't like the continuation quote because they want to be able to paste text and not have to worry much about formatting it afterwards.
More information about the swift-evolution