<div dir="ltr">Hello –<div><br></div><div>Currently, the standard library String functions .hasPrefix() and .hasSuffix() will return false when given the empty string as input:</div><div><br></div><div><div>$ swift</div><div>  1&gt; &quot;&quot;.hasPrefix(&quot;&quot;)</div><div>$R0: Bool = false</div><div>  2&gt; &quot;foo&quot;.hasPrefix(&quot;&quot;) </div><div>$R1: Bool = false</div><div>  3&gt; &quot;foo&quot;.hasSuffix(&quot;&quot;)</div><div>$R2: Bool = false</div></div><div><br></div><div><br></div><div>This feels unexpected. The reason the methods behave this way seems to be <a href="https://twitter.com/cdntr/status/755059959713427456" target="_blank">a leaked implementation detail</a>.</div><div>Some languages, such as Python, return True in these cases -- perhaps motivated by the `someSet.contains(emptySet) == true` analogy.</div><div><br></div><div>The ship has sailed for NSString and Foundation, but we might want to bite the bullet and fix this for Swift before 3.0 makes that much harder.</div><div><br></div><div>Thank you so much for your time,</div><div><br></div><div>    Chris</div></div>