@@ -160,9 +160,9 @@ extension String {
160
160
/// Returns a human-readable string giving the name of a given encoding.
161
161
@warn_unused_result
162
162
public static func localizedName(
163
- ofStringEncoding encoding: NSStringEncoding
163
+ of encoding: NSStringEncoding
164
164
) -> String {
165
- return NSString . localizedName ( ofStringEncoding : encoding)
165
+ return NSString . localizedName ( of : encoding)
166
166
}
167
167
168
168
// + (instancetype)localizedStringWithFormat:(NSString *)format, ...
@@ -251,8 +251,8 @@ extension String {
251
251
/// `String` can be converted to a given encoding without loss of
252
252
/// information.
253
253
@warn_unused_result
254
- public func canBeConverted( toEncoding encoding: NSStringEncoding ) -> Bool {
255
- return _ns. canBeConverted ( toEncoding : encoding)
254
+ public func canBeConverted( to encoding: NSStringEncoding ) -> Bool {
255
+ return _ns. canBeConverted ( to : encoding)
256
256
}
257
257
258
258
// @property NSString* capitalizedString
@@ -277,8 +277,8 @@ extension String {
277
277
/// Returns a capitalized representation of the `String`
278
278
/// using the specified locale.
279
279
@warn_unused_result
280
- public func capitalizedString ( with locale: NSLocale ? ) -> String {
281
- return _ns. capitalizedString ( with: locale) as String
280
+ public func capitalized ( with locale: NSLocale ? ) -> String {
281
+ return _ns. capitalized ( with: locale) as String
282
282
}
283
283
284
284
// - (NSComparisonResult)caseInsensitiveCompare:(NSString *)aString
@@ -399,11 +399,9 @@ extension String {
399
399
/// Returns an array containing substrings from the `String`
400
400
/// that have been divided by characters in a given set.
401
401
@warn_unused_result
402
- public func componentsSeparatedByCharacters(
403
- in separator: NSCharacterSet
404
- ) -> [ String ] {
402
+ public func components( separatedBy separator: NSCharacterSet ) -> [ String ] {
405
403
// FIXME: two steps due to <rdar://16971181>
406
- let nsa = _ns. componentsSeparatedByCharacters ( in : separator) as NSArray
404
+ let nsa = _ns. components ( separatedBy : separator) as NSArray
407
405
// Since this function is effectively a bridge thunk, use the
408
406
// bridge thunk semantics for the NSArray conversion
409
407
return nsa as! [ String ]
@@ -414,8 +412,8 @@ extension String {
414
412
415
413
/// Returns an array containing substrings from the `String`
416
414
/// that have been divided by a given separator.
417
- public func componentsSeparated ( by separator: String ) -> [ String ] {
418
- let nsa = _ns. componentsSeparated ( by : separator) as NSArray
415
+ public func components ( separatedBy separator: String ) -> [ String ] {
416
+ let nsa = _ns. components ( separatedBy : separator) as NSArray
419
417
// Since this function is effectively a bridge thunk, use the
420
418
// bridge thunk semantics for the NSArray conversion
421
419
return nsa as! [ String ]
@@ -426,10 +424,10 @@ extension String {
426
424
/// Returns a representation of the `String` as a C string
427
425
/// using a given encoding.
428
426
@warn_unused_result
429
- public func cString( usingEncoding encoding: NSStringEncoding ) -> [ CChar ] ? {
427
+ public func cString( using encoding: NSStringEncoding ) -> [ CChar ] ? {
430
428
return withExtendedLifetime ( _ns) {
431
429
( s: NSString ) -> [ CChar ] ? in
432
- _persistCString ( s. cString ( usingEncoding : encoding) )
430
+ _persistCString ( s. cString ( using : encoding) )
433
431
}
434
432
}
435
433
@@ -443,11 +441,11 @@ extension String {
443
441
/// the `String` encoded using a given encoding.
444
442
@warn_unused_result
445
443
public func data(
446
- usingEncoding encoding: NSStringEncoding ,
444
+ using encoding: NSStringEncoding ,
447
445
allowLossyConversion: Bool = false
448
446
) -> NSData ? {
449
447
return _ns. data (
450
- usingEncoding : encoding,
448
+ using : encoding,
451
449
allowLossyConversion: allowLossyConversion)
452
450
}
453
451
@@ -995,8 +993,8 @@ extension String {
995
993
/// Returns the number of bytes required to store the
996
994
/// `String` in a given encoding.
997
995
@warn_unused_result
998
- public func lengthOfBytes( usingEncoding encoding: NSStringEncoding ) -> Int {
999
- return _ns. lengthOfBytes ( usingEncoding : encoding)
996
+ public func lengthOfBytes( using encoding: NSStringEncoding ) -> Int {
997
+ return _ns. lengthOfBytes ( using : encoding)
1000
998
}
1001
999
1002
1000
// - (NSRange)lineRangeForRange:(NSRange)aRange
@@ -1086,8 +1084,8 @@ extension String {
1086
1084
/// converted to lowercase, taking into account the specified
1087
1085
/// locale.
1088
1086
@warn_unused_result
1089
- public func lowercaseString ( with locale: NSLocale ? ) -> String {
1090
- return _ns. lowercaseString ( with: locale)
1087
+ public func lowercased ( with locale: NSLocale ? ) -> String {
1088
+ return _ns. lowercased ( with: locale)
1091
1089
}
1092
1090
1093
1091
// - (NSUInteger)maximumLengthOfBytesUsingEncoding:(NSStringEncoding)enc
@@ -1096,8 +1094,8 @@ extension String {
1096
1094
/// `String` in a given encoding.
1097
1095
@warn_unused_result
1098
1096
public
1099
- func maximumLengthOfBytes( usingEncoding encoding: NSStringEncoding ) -> Int {
1100
- return _ns. maximumLengthOfBytes ( usingEncoding : encoding)
1097
+ func maximumLengthOfBytes( using encoding: NSStringEncoding ) -> Int {
1098
+ return _ns. maximumLengthOfBytes ( using : encoding)
1101
1099
}
1102
1100
1103
1101
// - (NSRange)paragraphRangeForRange:(NSRange)aRange
@@ -1338,9 +1336,9 @@ extension String {
1338
1336
/// the `String` into a legal URL string.
1339
1337
@available ( * , deprecated, message: " Use addingPercentEncoding(withAllowedCharacters:) instead, which always uses the recommended UTF-8 encoding, and which encodes for a specific URL component or subcomponent since each URL component or subcomponent has different rules for what characters are valid. " )
1340
1338
public func addingPercentEscapes(
1341
- usingEncoding encoding: NSStringEncoding
1339
+ using encoding: NSStringEncoding
1342
1340
) -> String ? {
1343
- return _ns. addingPercentEscapes ( usingEncoding : encoding)
1341
+ return _ns. addingPercentEscapes ( using : encoding)
1344
1342
}
1345
1343
1346
1344
// - (NSString *)stringByAppendingFormat:(NSString *)format, ...
@@ -1439,11 +1437,11 @@ extension String {
1439
1437
@warn_unused_result
1440
1438
public func padding(
1441
1439
toLength newLength: Int ,
1442
- with padString: String ,
1440
+ withPad padString: String ,
1443
1441
startingAt padIndex: Int
1444
1442
) -> String {
1445
1443
return _ns. padding (
1446
- toLength: newLength, with : padString, startingAt: padIndex)
1444
+ toLength: newLength, withPad : padString, startingAt: padIndex)
1447
1445
}
1448
1446
1449
1447
// @property NSString* stringByRemovingPercentEncoding;
@@ -1506,9 +1504,9 @@ extension String {
1506
1504
/// by a given encoding.
1507
1505
@available ( * , deprecated, message: " Use removingPercentEncoding instead, which always uses the recommended UTF-8 encoding. " )
1508
1506
public func replacingPercentEscapes(
1509
- usingEncoding encoding: NSStringEncoding
1507
+ using encoding: NSStringEncoding
1510
1508
) -> String ? {
1511
- return _ns. replacingPercentEscapes ( usingEncoding : encoding)
1509
+ return _ns. replacingPercentEscapes ( using : encoding)
1512
1510
}
1513
1511
1514
1512
// @property NSString* stringByResolvingSymlinksInPath;
@@ -1589,8 +1587,8 @@ extension String {
1589
1587
/// converted to uppercase, taking into account the specified
1590
1588
/// locale.
1591
1589
@warn_unused_result
1592
- public func uppercaseString ( with locale: NSLocale ? ) -> String {
1593
- return _ns. uppercaseString ( with: locale)
1590
+ public func uppercased ( with locale: NSLocale ? ) -> String {
1591
+ return _ns. uppercased ( with: locale)
1594
1592
}
1595
1593
1596
1594
//===--- Omitted due to redundancy with "utf8" property -----------------===//
@@ -1684,7 +1682,7 @@ extension String {
1684
1682
// Pre-Swift-3 method names
1685
1683
extension String {
1686
1684
1687
- @available ( * , unavailable, renamed: " localizedName(ofStringEncoding :) " )
1685
+ @available ( * , unavailable, renamed: " localizedName(of :) " )
1688
1686
public static func localizedNameOfStringEncoding(
1689
1687
_ encoding: NSStringEncoding
1690
1688
) -> String {
@@ -1696,7 +1694,7 @@ extension String {
1696
1694
fatalError ( " unavailable function can't be called " )
1697
1695
}
1698
1696
1699
- @available ( * , unavailable, renamed: " canBeConverted(toEncoding :) " )
1697
+ @available ( * , unavailable, renamed: " canBeConverted(to :) " )
1700
1698
public func canBeConvertedToEncoding( _ encoding: NSStringEncoding ) -> Bool {
1701
1699
fatalError ( " unavailable function can't be called " )
1702
1700
}
@@ -1722,7 +1720,7 @@ extension String {
1722
1720
fatalError ( " unavailable function can't be called " )
1723
1721
}
1724
1722
1725
- @available ( * , unavailable, renamed: " componentsSeparatedByCharacters(in :)" )
1723
+ @available ( * , unavailable, renamed: " components(separatedBy :)" )
1726
1724
public func componentsSeparatedByCharactersIn(
1727
1725
_ separator: NSCharacterSet
1728
1726
) -> [ String ] {
@@ -1804,7 +1802,7 @@ extension String {
1804
1802
fatalError ( " unavailable function can't be called " )
1805
1803
}
1806
1804
1807
- @available ( * , unavailable, renamed: " lengthOfBytes(usingEncoding :) " )
1805
+ @available ( * , unavailable, renamed: " lengthOfBytes(using :) " )
1808
1806
public func lengthOfBytesUsingEncoding( _ encoding: NSStringEncoding ) -> Int {
1809
1807
fatalError ( " unavailable function can't be called " )
1810
1808
}
@@ -1825,12 +1823,12 @@ extension String {
1825
1823
fatalError ( " unavailable function can't be called " )
1826
1824
}
1827
1825
1828
- @available ( * , unavailable, renamed: " lowercaseString (with:)" )
1826
+ @available ( * , unavailable, renamed: " lowercased (with:)" )
1829
1827
public func lowercaseStringWith( _ locale: NSLocale ? ) -> String {
1830
1828
fatalError ( " unavailable function can't be called " )
1831
1829
}
1832
1830
1833
- @available ( * , unavailable, renamed: " maximumLengthOfBytes(usingEncoding :) " )
1831
+ @available ( * , unavailable, renamed: " maximumLengthOfBytes(using :) " )
1834
1832
public
1835
1833
func maximumLengthOfBytesUsingEncoding( _ encoding: NSStringEncoding ) -> Int {
1836
1834
fatalError ( " unavailable function can't be called " )
@@ -1885,7 +1883,7 @@ extension String {
1885
1883
fatalError ( " unavailable function can't be called " )
1886
1884
}
1887
1885
1888
- @available ( * , unavailable, renamed: " addingPercentEscapes(usingEncoding :) " )
1886
+ @available ( * , unavailable, renamed: " addingPercentEscapes(using :) " )
1889
1887
public func addingPercentEscapesUsingEncoding(
1890
1888
_ encoding: NSStringEncoding
1891
1889
) -> String ? {
@@ -1962,7 +1960,7 @@ extension String {
1962
1960
fatalError ( " unavailable function can't be called " )
1963
1961
}
1964
1962
1965
- @available ( * , unavailable, renamed: " uppercaseString (with:)" )
1963
+ @available ( * , unavailable, renamed: " uppercased (with:)" )
1966
1964
public func uppercaseStringWith( _ locale: NSLocale ? ) -> String {
1967
1965
fatalError ( " unavailable function can't be called " )
1968
1966
}
0 commit comments