This almost seems more like a bug than a change request. Definitely agree.
+1 - this shouldn't be hard to fix either - in StringLegacy.swift, add a
check for prefix.isEmpty and return true...
> Hello –
> Currently, the standard library String functions .hasPrefix() and
.hasSuffix() will return false when given the empty string as input:
> $ swift
> $R0: Bool = false
> $R1: Bool = false
> $R2: Bool = false
> This feels unexpected. The reason the methods behave this way seems to
bea leaked implementation detail(
> Some languages, such as Python, return True in these cases -- perhaps
motivated by the `someSet.contains(emptySet) == true` analogy.
> 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.
> Thank you so much for your time,
> swift-evolution mailing list