<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 <<a href="mailto:swift-users@swift.org" class="">swift-users@swift.org</a>> 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=""> public func deleting(prefix inPrefix: String) -> String<br class=""> public func deleting(prefix inPrefix: String) -> 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> let a = s.deleting(prefix: "foo") as String</div><div>or</div><div> 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>-- </div><div>Greg Parker <a href="mailto:gparker@apple.com" class="">gparker@apple.com</a> Runtime Wrangler</div><div><br class=""></div><br class=""></body></html>