File tree Expand file tree Collapse file tree 1 file changed +12
-12
lines changed Expand file tree Collapse file tree 1 file changed +12
-12
lines changed Original file line number Diff line number Diff line change @@ -1428,29 +1428,29 @@ extension String : _NSBridgeable, _CFBridgeable {
1428
1428
#if !(os(OSX) || os(iOS))
1429
1429
extension String {
1430
1430
public func hasPrefix( _ prefix: String ) -> Bool {
1431
+ if prefix. isEmpty {
1432
+ return true
1433
+ }
1434
+
1431
1435
let cfstring = self . _cfObject
1432
1436
let range = CFRangeMake ( 0 , CFStringGetLength ( cfstring) )
1433
1437
let opts = CFStringCompareFlags (
1434
1438
kCFCompareAnchored | kCFCompareNonliteral)
1435
- if prefix. isEmpty {
1436
- return true
1437
- } else {
1438
- return CFStringFindWithOptions ( cfstring, prefix. _cfObject,
1439
- range, opts, nil )
1440
- }
1439
+ return CFStringFindWithOptions ( cfstring, prefix. _cfObject,
1440
+ range, opts, nil )
1441
1441
}
1442
1442
1443
1443
public func hasSuffix( _ suffix: String ) -> Bool {
1444
+ if suffix. isEmpty {
1445
+ return true
1446
+ }
1447
+
1444
1448
let cfstring = self . _cfObject
1445
1449
let range = CFRangeMake ( 0 , CFStringGetLength ( cfstring) )
1446
1450
let opts = CFStringCompareFlags (
1447
1451
kCFCompareAnchored | kCFCompareBackwards | kCFCompareNonliteral)
1448
- if suffix. isEmpty {
1449
- return true
1450
- } else {
1451
- return CFStringFindWithOptions ( cfstring, suffix. _cfObject,
1452
- range, opts, nil )
1453
- }
1452
+ return CFStringFindWithOptions ( cfstring, suffix. _cfObject,
1453
+ range, opts, nil )
1454
1454
}
1455
1455
}
1456
1456
#endif
You can’t perform that action at this time.
0 commit comments