String
extension String
-
PowerUpSwift: A
mutating
counterpart ofsantized()
.Declaration
Swift
public mutating func sanitize()
-
PowerUpSwift: Returns the trimmed valueof the String by:
- removing all the white spaces and white new lines around
- replacing two or more spaces inside with a single space
- replacing three or more new lines inside with two new lines
It should just work! Trust PowerUpSwift. 😂😂😂
Declaration
Swift
public func sanitized() -> String
-
PowerUpSwift: Checks if the String is a valid email and returns a
Bool
value.Declaration
Swift
public var isValidEmail: Bool { get }
-
PowerUpSwift: Returns the reversed value of
isValidEmail
so it feels more natural to write than using an exclamation point.Declaration
Swift
public var isNotValidEmail: Bool { get }
-
PowerUpSwift: Returns the reversed value of
isEmpty
so it feels more natural to write than using an exclamation point.Declaration
Swift
public var isNotEmpty: Bool { get }
-
PowerUpSwift: Uses the very
String
as the key in the main bundle’s localizable resources and returns the value.Declaration
Swift
public var localized: String { get }
-
PowerUpSwift: Uses the very
String
as the key in the specified bundle’s localizable resources and returns the value.Declaration
Swift
public func localized(in bundle: Bundle?, comment: String = "") -> String
-
PowerUpSwift: Checks if the String is a valid IP address and returns a
Bool
value.Declaration
Swift
public var isValidIP: Bool { get }
-
PowerUpSwift: Returns the reversed value of
isValidIP
so it feels more natural to write than using an exclamation point.Declaration
Swift
public var isNotValidIP: Bool { get }
-
PowerUpSwift: Checks if the String is a valid mac address and returns a
Bool
value.Declaration
Swift
public var isValidMAC: Bool { get }
-
PowerUpSwift: Returns the reversed value of
isValidMAC
so it feels more natural to write than using an exclamation point.Declaration
Swift
public var isNotValidMAC: Bool { get }
-
PowerUpSwift: Returns the
Dictionary
form of theString
if the format is valid ornil
if invalid.Declaration
Swift
public var json: [String : Any]? { get }
-
PowerUpSwift: Parses the
String
and returns the payloadDictionary
if it’s a valid JWT.Declaration
Swift
public var jwtPayload: [String : Any]? { get }