Doesn&#39;t your second argument undermine your first? If it&#39;s a trivial solution and one rarely ever considers empty strings when invoking `hasPrefix`, then returning the technically correct result must be a trivial departure in behavior.<br><br><br><div class="gmail_quote"><div dir="ltr">On Wed, Jul 20, 2016 at 15:14 Guillaume Lessard via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org">swift-evolution@swift.org</a>&gt; wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br>
&gt; On 20 juil. 2016, at 12:42, Michael Peternell via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>&gt; wrote:<br>
&gt;<br>
&gt; +1<br>
&gt; this should be a bugfix.<br>
<br>
First, NSString’s prefix function returns false for empty string parameters, and this would be a significant departure in behaviour.<br>
<br>
Second, while an empty string is technically a prefix to any other string, that is hardly ever an interesting answer; it is a trivial solution, just as y=0 is for y(x)=y’(x). It is easy to special-case if one really needs to consider the empty string.<br>
<br>
Cheers,<br>
Guillaume Lessard<br>
<br>
_______________________________________________<br>
swift-evolution mailing list<br>
<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a><br>
<a href="https://lists.swift.org/mailman/listinfo/swift-evolution" rel="noreferrer" target="_blank">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br>
</blockquote></div>