<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">The String initializer that would actually be of most value to me would be:<div class=""><br class=""></div><div class="">String.init(utf8: UnsafePointer<UInt8>, length: Int)</div><div class=""><br class=""></div><div class="">as long as it is as fast (preferably faster) than String.fromCString() and doesn’t require bridging to NSString. A similar initializer is available for NSString, but as Zach indicated in his link, using it is slow.</div><div class=""><br class=""></div><div class="">Several other initializers, including the one you showed, would be useful, as long as they are performant.</div><div class=""><br class=""></div><div class="">—CK</div><div class=""><br class=""></div><div class=""><div><blockquote type="cite" class=""><div class="">On Jan 8, 2016, at 9:04 PM, 品雪 via swift-evolution <<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class="">Sorry, I didn't get it, are you talking about:<div class=""><br class=""></div><div class=""><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="color:rgb(187,44,162)" class="">var</span> bytes : [<span style="color:rgb(112,61,170)" class="">UInt8</span>] = [<span style="color:rgb(39,42,216)" class="">65</span>, <span style="color:rgb(39,42,216)" class="">66</span>, <span style="color:rgb(39,42,216)" class="">67</span>, <span style="color:rgb(39,42,216)" class="">68</span>, <span style="color:rgb(39,42,216)" class="">69</span>, <span style="color:rgb(39,42,216)" class="">70</span>];</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="color:rgb(187,44,162)" class="">var</span> s = <span style="color:rgb(112,61,170)" class="">String</span>.<span style="color:rgb(187,44,162)" class="">init</span>(bytes: <span style="color:rgb(79,129,135)" class="">bytes</span>, encoding: <span style="color:rgb(112,61,170)" class="">NSUTF8StringEncoding</span>)</div><div class=""><br class=""></div><div class="">?</div><div class="gmail_extra"><br class=""><div class="gmail_quote">On Sat, Jan 9, 2016 at 8:22 AM, T.J. Usiyan via swift-evolution <span dir="ltr" class=""><<a href="mailto:swift-evolution@swift.org" target="_blank" class="">swift-evolution@swift.org</a>></span> wrote:<br class=""><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr" class="">I support this change as well.<div class=""><br class=""></div><div class="">TJ</div></div><div class=""><div class=""><div class="gmail_extra"><br class=""><div class="gmail_quote">On Fri, Jan 8, 2016 at 6:06 PM, Guillaume Lessard via swift-evolution <span dir="ltr" class=""><<a href="mailto:swift-evolution@swift.org" target="_blank" class="">swift-evolution@swift.org</a>></span> wrote:<br class=""><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">Complete agreement from me. I would like to see a String constructor from a Sequence of code units.<br class="">
Also, why is String.fromCString() a factory function rather than a fallible constructor?<br class="">
<br class="">
Guillaume Lessard<br class="">
<div class=""><div class=""><br class="">
_______________________________________________<br class="">
swift-evolution mailing list<br class="">
<a href="mailto:swift-evolution@swift.org" target="_blank" class="">swift-evolution@swift.org</a><br class="">
<a href="https://lists.swift.org/mailman/listinfo/swift-evolution" rel="noreferrer" target="_blank" class="">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br class="">
</div></div></blockquote></div><br class=""></div>
</div></div><img src="https://u2002410.ct.sendgrid.net/wf/open?upn=zv-2Fta8zZnJ-2BWwISX5RHdd79su-2FjoebtLz43a4s-2BYOw1YUwmckQZetWwzLJetjkg0VLSsYeNrva793asxb2J13O0wwqKRDxIuX1zxa3yr9JEBz1QkaGutYcMvEh8twd8aHreITfNteRdIaIIXFmIHam7GtGEq3rInmgnYBA12e6I8pUV52QJZ1uhb-2F70FWI-2BSizejFgZy-2BY-2Blox8jB6myHqQON-2BWIOMwsJohYKvreruE-3D" alt="" width="1" height="1" border="0" style="min-height: 1px !important; width: 1px !important; border-width: 0px !important; margin: 0px !important; padding: 0px !important;" class="">
<br class="">_______________________________________________<br class="">
swift-evolution mailing list<br class="">
<a href="mailto:swift-evolution@swift.org" target="_blank" class="">swift-evolution@swift.org</a><br class="">
<a href="https://lists.swift.org/mailman/listinfo/swift-evolution" rel="noreferrer" target="_blank" class="">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br class="">
<br class=""></blockquote></div><br class=""><br clear="all" class=""><div class=""><br class=""></div>-- <br class=""><div class=""><div dir="ltr" class="">Best Regards!<br class=""><br class="">Yang Wu<br class="">--------------------------------------------------------<br class="">Location: Pudong, Shanghai, China.<br class="">EMail : <a href="mailto:pinxue@gmail.com" target="_blank" class="">pinxue@gmail.com</a><br class="">Website: <a href="http://www.time2change.mobi/" target="_blank" class="">http://www.time2change.mobi</a> <a href="http://rockplayer.com/" target="_blank" class="">http://rockplayer.com</a><br class="">Twitter/Weibo : @pinxue<br class=""><a href="http://www.pinxue.net/" target="_blank" class=""></a></div></div>
</div></div></div>
<img src="https://u2002410.ct.sendgrid.net/wf/open?upn=F5lQLlMRbBDxNsThVg1FdaN-2FDA1CiFgV-2FmWJt88lR-2Fpi3AyL-2BYPfTLOWQEDSTRbaIzBgmlUrJotWJuXiWb1uR7Sg6jpwJiAkj1xrmCz-2FdEUGwVQianLN8REjX9vG-2Fnq0LDW8rmcSG-2BwGVpGANJ0u3DV4c1uZTOLxurng76JzxwcBfIYXhPubJOJiKA-2BpVcmyhWbkVort64NR6yR5Y-2B8JOQ-3D-3D" alt="" width="1" height="1" border="0" style="height:1px !important;width:1px !important;border-width:0 !important;margin-top:0 !important;margin-bottom:0 !important;margin-right:0 !important;margin-left:0 !important;padding-top:0 !important;padding-bottom:0 !important;padding-right:0 !important;padding-left:0 !important;" class="">
_______________________________________________<br class="">swift-evolution mailing list<br class=""><a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a><br class="">https://lists.swift.org/mailman/listinfo/swift-evolution<br class=""></div></blockquote></div><br class=""></div></body></html>