99import Foundation
1010
1111public extension Int {
12-
12+
1313 /**
1414 Returns a string containing the formatted value of the provided number object.
1515
1616 :returns: A string containing the formatted value of number using the PGLFormatter.numberFormatter settings.
1717 */
18- func format( ) -> String {
19-
20-
18+ func format( ) -> String {
19+
2120 return PGLFormatter . numberFormatter. string ( for: self ) !
2221 }
23-
22+
2423 /**
2524 Converts a byte count into a string without creating an NSNumber object.
2625
@@ -29,51 +28,50 @@ public extension Int {
2928 func formatToByte( ) -> String {
3029 return PGLFormatter . byteFormatter. string ( fromByteCount: Int64 ( self ) )
3130 }
32-
31+
3332 /**
3433 Format a number in meters to a localized string with the locale-appropriate unit and an appropriate scale (e.g. 4.3m = 14.1ft in the US locale).
3534
3635 :returns: A string that combines a value and a unit string appropriate for the PGLFormatter.lenghtFormatter's locale.
3736 */
38- func formatLenghtFromMeters( ) -> String {
37+ func formatLenghtFromMeters( ) -> String {
3938 return PGLFormatter . lenghtFormatter. string ( fromMeters: Double ( self ) )
4039 }
41-
40+
4241 /**
4342 Format a combination of a number and an unit to a localized string.
4443 :param unit The unit used in the resulting length string.
4544
4645 :returns: A localized string that combines self value and unit.
4746 */
48- func formatLenght( _ unit: LengthFormatter . Unit ) -> String {
47+ func formatLenght( _ unit: LengthFormatter . Unit ) -> String {
4948 return PGLFormatter . lenghtFormatter. string ( fromValue: Double ( self ) , unit: unit)
5049 }
51-
50+
5251 /**
5352 Returns a mass string for self value.
5453
5554 :returns: A string that combines a value and a unit string appropriate for the formatter’s locale.
5655 */
57- func formatMassFromKilograms( ) -> String {
56+ func formatMassFromKilograms( ) -> String {
5857 return PGLFormatter . massFormatter. string ( fromKilograms: Double ( self ) )
5958 }
60-
61-
59+
6260 /**
6361 Returns a properly formatted mass string for self value and unit.
6462 :param: unit The unit used in the resulting mass string.
6563
6664 :returns: A localized string that combines self value and unit.
6765 */
68- func formatMass( _ unit: MassFormatter . Unit ) -> String {
66+ func formatMass( _ unit: MassFormatter . Unit ) -> String {
6967 return PGLFormatter . massFormatter. string ( fromValue: Double ( self ) , unit: unit)
7068 }
7169
7270 /**
7371 Returns a properly formatted time string for self
7472 :returns: A localized string that combines self.
7573 */
76- func formatTime( ) -> String ? {
74+ func formatTime( ) -> String ? {
7775 return PGLFormatter . timeFormatter. string ( from: Double ( self ) )
7876 }
7977}
@@ -87,7 +85,5 @@ public extension Int64 {
8785 func formatToByte( ) -> String {
8886 return PGLFormatter . byteFormatter. string ( fromByteCount: self )
8987 }
90-
91-
9288
9389}
0 commit comments