<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=""><br class=""><div><blockquote type="cite" class=""><div class="">On Oct 13, 2016, at 2:36 PM, Rick Mann via swift-users &lt;<a href="mailto:swift-users@swift.org" class="">swift-users@swift.org</a>&gt; wrote:</div><br class="Apple-interchange-newline"><div class=""><div class="">It seems I can write this:<br class=""><br class="">extension String<br class="">{<br class=""> &nbsp;public func deleting(prefix inPrefix: String) -&gt; String<br class=""> &nbsp;public func deleting(prefix inPrefix: String) -&gt; String?<br class="">}<br class=""><br class="">But I was hoping it would do the right thing:<br class=""><br class="">let a = s.deleting(prefix: "foo")<br class="">if let b = s.deleting(prefix: "foo") { }<br class=""><br class="">But it finds these ambiguous, and I'm not sure how to specify which I want.</div></div></blockquote><br class=""></div><div>You can specify which you want by explicitly naming the type:</div><div>&nbsp; &nbsp; let a = s.deleting(prefix: "foo") as String</div><div>or</div><div>&nbsp; &nbsp; let a : String = s.deleting(prefix: "foo")</div><div><br class=""></div><div>…but presumably that doesn't give you the usability that you were hoping for.</div><div><br class=""></div><div><br class=""></div><div>--&nbsp;</div><div>Greg Parker &nbsp; &nbsp;&nbsp;<a href="mailto:gparker@apple.com" class="">gparker@apple.com</a>&nbsp; &nbsp; &nbsp;Runtime Wrangler</div><div><br class=""></div><br class=""></body></html>