mirror of
https://github.com/apple/swift.git
synced 2026-06-20 15:42:51 +02:00
5039cccf80
There's a longstanding problem in implementing `-isEqualToString:`, where if you don't know how to get fast access to the other NSString's contents, you have to pick between doing it character by character (very slow), or calling [other isEqualToString: self], which risks infinite recursion if the other string does the same. This cuts the gordian knot by adding a new method `isEqualToBytes:encoding:count:`, so you can get the contents out of `self`, and hand it to the other string, confident that it will not need to (nor, in fact be able to) ask you anything that might recurse.