<div dir="ltr"><div class="gmail_default" style="font-family:georgia,serif">​For a new line, Unix uses LF, Classic Mac uses  ​CR, Windows uses  CRLF. They both means the CR in Unicode.</div><div class="gmail_default" style="font-family:georgia,serif"><br></div><div class="gmail_default" style="font-family:georgia,serif"><p style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo"><span style="color:rgb(187,44,162)">let</span> str = <span style="color:rgb(209,47,27)">&quot;\r\n&quot;</span></p>
<p style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(112,61,170)"><span style="color:rgb(79,129,135)">str</span><span style="color:rgb(0,0,0)">.</span>characters<span style="color:rgb(0,0,0)">.</span>count<span style="color:rgb(0,0,0)"> </span><span style="color:rgb(0,132,0)">// 1</span></p>
<p style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(61,29,129)"><span style="color:rgb(79,129,135)">str</span><span style="color:rgb(0,0,0)">.</span>lengthOfBytesUsingEncoding<span style="color:rgb(0,0,0)">(</span><span style="color:rgb(112,61,170)">NSUTF8StringEncoding</span><span style="color:rgb(0,0,0)">) </span><span style="color:rgb(0,132,0)">// 2</span></p>
<p style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(112,61,170)"><span style="color:rgb(79,129,135)">str</span><span style="color:rgb(0,0,0)">.</span>unicodeScalars<span style="color:rgb(0,0,0)">.</span>first<span style="color:rgb(0,0,0)">!.</span>value<span style="color:rgb(0,0,0)"> </span><span style="color:rgb(0,132,0)">// 13</span></p><p style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(112,61,170)"><span style="color:rgb(0,132,0)"><br></span></p><p style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(112,61,170)"><span style="color:rgb(0,132,0)">zhaoxin</span></p></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Jan 28, 2016 at 11:52 AM, Darren Mo via swift-users <span dir="ltr">&lt;<a href="mailto:swift-users@swift.org" target="_blank">swift-users@swift.org</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word"><font face="Menlo" style="font-size:11px">&quot;\r\n&quot;</font> is a single <font face="Menlo" style="font-size:11px">Character</font><font>.</font> Is this the correct behaviour?</div><br>_______________________________________________<br>
swift-users mailing list<br>
<a href="mailto:swift-users@swift.org">swift-users@swift.org</a><br>
<a href="https://lists.swift.org/mailman/listinfo/swift-users" rel="noreferrer" target="_blank">https://lists.swift.org/mailman/listinfo/swift-users</a><br>
<br></blockquote></div><br></div>