<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"></head><body dir="auto"><div><br><div><div><span style="background-color: rgba(255, 255, 255, 0);">Hi Michael</span></div><div>also inline</div><div><div apple-content-edited="true"><div><div><font color="#000000"><span style="background-color: rgba(255, 255, 255, 0);"></span></font></div></div></div></div></div></div><div><br>On 26 Apr 2016, at 22:05, Michael Peternell <<a href="mailto:michael.peternell@gmx.at">michael.peternell@gmx.at</a>> wrote:<br><br></div><blockquote type="cite"><div><span>Comments inline.</span><br><span></span><br><blockquote type="cite"><span>Am 26.04.2016 um 15:32 schrieb Ted F.A. van Gaalen <<a href="mailto:tedvgiosdev@gmail.com">tedvgiosdev@gmail.com</a>>:</span><br></blockquote><blockquote type="cite"><span></span><br></blockquote><blockquote type="cite"><span>Hi Michael</span><br></blockquote><blockquote type="cite"><span></span><br></blockquote><blockquote type="cite"><span>What happens if a delimiter in this case: “”” </span><br></blockquote><blockquote type="cite"><span>occurs embedded in the data? like so (two times here):</span><br></blockquote><span></span><br><span>that's a problem you always have.</span></div></blockquote>It is not a problem with the "data line" method that I suggest...<br><blockquote type="cite"><div><span> And I think pasting a few lines of text is a (much) more common use case than wanting to have a string literal that contains """ in it. </span></div></blockquote>..all you have to do is paste your few lines of text an put \@ in front of each line...<div>** (see further in text)</div><div><br><div>If copying larger texts, it might be better to use a resource (file) instead of</div><div>hard coding all that data into a multi-line string. </div><div><br></div><div> </div><br><blockquote type="cite"><div><span>I have never needed a string literal that contained """, and as long as you don't create a parser for a language that wants to parse such literals, the use cases are very rare IMO. </span></div></blockquote>Swift is a general purpose language used for making many different applications..</div><div><br></div><div><br></div><div><blockquote type="cite"><div><span>Furthermore, if the string interpolation and escape sequences are enabled, I can answer this directly: you write """some text</span><br><span>some text. Here you have 3 double quotes: ""\" and here again \"""</span><br><span>"""; you can just put a backslash before one of the offending double quotes.</span><br><span></span><br></div></blockquote>then you would have to change all the " in say an Xml group of lines.<br><blockquote type="cite"><div><span>I think starting each line with \\ is really ugly, </span></div></blockquote>Ok, but that's just a matter of personal taste...</div><div>I'll gladly give up some esthetics for better functionality.</div><div><blockquote type="cite"><div><span>and I wouldn't consider this a true "multi-line string literal". Because instead of writing</span><br><span></span><br><span>\\bla bla</span><br><span>\\bla bla</span><br><span></span><br><span>I'd rather write</span><br><span></span><br></div></blockquote>this:<br><blockquote type="cite"><div><span>"bla bla\n"</span><br><span>"bla bla"</span><br></div></blockquote><div>already exists with + ... +</div>but then you have to add \n as well and use escape \" all the time.</div><div>e.g. when coding Html lines with parameters.<br><blockquote type="cite"><div><blockquote type="cite"><span></span><br></blockquote><blockquote type="cite"><span>“””</span><br></blockquote><blockquote type="cite"><span>dfksposdkj dslkd s hfdslk dskdslk lskd sk aaasd</span><br></blockquote><blockquote type="cite"><span>lfsdlks dslksd sdlk sdlksd “”” fskfsdalkfsd “”” fdjf dkjfds </span><br></blockquote><blockquote type="cite"><span>“”"</span><br></blockquote><blockquote type="cite"><span></span><br></blockquote><blockquote type="cite"><span>Having a particular token at the start of a line (or after leading space(s) ) to define a data line </span><br></blockquote><blockquote type="cite"><span>allows us to use *all* available characters behind it. </span><br></blockquote><blockquote type="cite"><span></span><br></blockquote><blockquote type="cite"><span>Actually after further thinking, I assume that 1 token is not enough, perhaps there should be two tokens e.g.</span><br></blockquote><blockquote type="cite"><span></span><br></blockquote><blockquote type="cite"><span> \\ ……………... to process escaped chars, like \… and \(item), </span><br></blockquote><blockquote type="cite"><span> the same way as with normal Swift string literals</span><br></blockquote><blockquote type="cite"><span></span><br></blockquote><blockquote type="cite"><span> \@…………. to take all characters as is without conversion? </span><br></blockquote><blockquote type="cite"><span></span><br></blockquote><blockquote type="cite"><span></span><br></blockquote><blockquote type="cite"><span>Examples:</span><br></blockquote><blockquote type="cite"><span>1.</span><br></blockquote><blockquote type="cite"><span>let someText = </span><br></blockquote><blockquote type="cite"><span>\\There are \t \t \(nrofboxes) boxes avai</span><br></blockquote><blockquote type="cite"><span>\\lable.</span><br></blockquote><blockquote type="cite"><span>converts to:</span><br></blockquote><blockquote type="cite"><span>"There are 12 boxes available."</span><br></blockquote><span></span><br><span>really? so I have to write \n if I want to have a newline?</span><br><br></div></blockquote>**<br>Yes, because here, \\ is used instead of other suggested token \@ </div><div>but respecting source-file-linefeeds could perhaps be an option</div><div>when using \@ ?</div><div><br><blockquote type="cite"><div><blockquote type="cite"><span></span><br></blockquote><blockquote type="cite"><span>2.</span><br></blockquote><blockquote type="cite"><span></span><br></blockquote><blockquote type="cite"><span>let someText = </span><br></blockquote><blockquote type="cite"><span>\@There are \t \t \(nrofboxes) boxes avai</span><br></blockquote><blockquote type="cite"><span>\@able.</span><br></blockquote><blockquote type="cite"><span>String taken as is, nothing is converted:</span><br></blockquote><blockquote type="cite"><span>"There are \t \t \(nrofboxes) boxes available."</span><br></blockquote><blockquote type="cite"><span></span><br></blockquote><blockquote type="cite"><span>Of course one could choose other tokens than \\ and \@</span><br></blockquote><blockquote type="cite"><span>they just looked convenient to me...</span><br></blockquote><blockquote type="cite"><span></span><br></blockquote><blockquote type="cite"><span>TedvG</span><br></blockquote><blockquote type="cite"><span></span><br></blockquote><blockquote type="cite"><span></span><br></blockquote><blockquote type="cite"><blockquote type="cite"><span>On 26.04.2016, at 07:53, Michael Peternell <<a href="mailto:michael.peternell@gmx.at">michael.peternell@gmx.at</a>> wrote:</span><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><span></span><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><span>"""Just in my opinion:</span><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><span>having to start each line with a particular token kinda defeats the purpose of multiline string literals.</span><br></blockquote></blockquote><blockquote type="cite"><span>Why? </span><br></blockquote><span></span><br><span>because IMHO the purpose of multiline string literals *is* that you can copy&paste multiple lines of text directly into the editor? If I call \\literals a 'multi-line literal', I can call "normal strings" multiline too, can't I?</span><br><span></span><br><span>What makes</span><br><span> \\this</span><br><span> \\string</span><br><span>a 'multiline string literal'</span><br><span> "and this "</span><br><span> "string"</span><br><span>not? (What is the definition of a "multiline string literal"?)</span><br><span></span><br><span>-Michael</span><br><span></span><br></div></blockquote>Regards, TedvG</div></body></html>