Skip to content

Commit f4c6332

Browse files
Merge pull request #1459 from airspeedswift/suffix-prefix
Remove hasPrefix/Suffix as they are now on String for Linux
2 parents 5ecb86c + 1032e8d commit f4c6332

File tree

2 files changed

+2
-34
lines changed

2 files changed

+2
-34
lines changed

Foundation/NSString.swift

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1479,36 +1479,6 @@ extension String : _NSBridgeable, _CFBridgeable {
14791479
internal var _cfObject: CFType { return _nsObject._cfObject }
14801480
}
14811481

1482-
#if !(os(OSX) || os(iOS))
1483-
extension String {
1484-
public func hasPrefix(_ prefix: String) -> Bool {
1485-
if prefix.isEmpty {
1486-
return true
1487-
}
1488-
1489-
let cfstring = self._cfObject
1490-
let range = CFRangeMake(0, CFStringGetLength(cfstring))
1491-
let opts = CFStringCompareFlags(
1492-
kCFCompareAnchored | kCFCompareNonliteral)
1493-
return CFStringFindWithOptions(cfstring, prefix._cfObject,
1494-
range, opts, nil)
1495-
}
1496-
1497-
public func hasSuffix(_ suffix: String) -> Bool {
1498-
if suffix.isEmpty {
1499-
return true
1500-
}
1501-
1502-
let cfstring = self._cfObject
1503-
let range = CFRangeMake(0, CFStringGetLength(cfstring))
1504-
let opts = CFStringCompareFlags(
1505-
kCFCompareAnchored | kCFCompareBackwards | kCFCompareNonliteral)
1506-
return CFStringFindWithOptions(cfstring, suffix._cfObject,
1507-
range, opts, nil)
1508-
}
1509-
}
1510-
#endif
1511-
15121482
extension NSString : _StructTypeBridgeable {
15131483
public typealias _StructType = String
15141484

TestFoundation/TestNSString.swift

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1328,8 +1328,7 @@ let comparisonTests: [ComparisonTest] = [
13281328

13291329
// U+1F1E7 REGIONAL INDICATOR SYMBOL LETTER B
13301330
// \u{1F1E7}\u{1F1E7} Flag of Barbados
1331-
ComparisonTest("\u{1F1E7}", "\u{1F1E7}\u{1F1E7}",
1332-
expectedFailure: "https://bugs.swift.org/browse/SR-367"),
1331+
ComparisonTest("\u{1F1E7}", "\u{1F1E7}\u{1F1E7}"),
13331332

13341333
// Test that Unicode collation is performed in deterministic mode.
13351334
//
@@ -1344,8 +1343,7 @@ let comparisonTests: [ComparisonTest] = [
13441343
//
13451344
// U+0301 and U+0954 don't decompose in the canonical decomposition mapping.
13461345
// U+0341 has a canonical decomposition mapping of U+0301.
1347-
ComparisonTest("\u{0301}", "\u{0341}",
1348-
expectedFailure: "https://bugs.swift.org/browse/SR-243"),
1346+
ComparisonTest("\u{0301}", "\u{0341}"),
13491347
ComparisonTest("\u{0301}", "\u{0954}"),
13501348
ComparisonTest("\u{0341}", "\u{0954}"),
13511349
]

0 commit comments

Comments
 (0)