String

struct String

String Extension.

  • Returns the Base64 encoded string

    Declaration

    Swift

    public func base64Encoded() -> String
  • Returns the Base64 decoded stirng for the current string. If cannot be decoded, return nil.

    Declaration

    Swift

    public func base64Decoded() -> String?
  • Returns the md5 hash of the string.

    Declaration

    Swift

    public func md5() -> String
  • Returns the SHA256 hash of the string.

    Declaration

    Swift

    public func sha256() -> String
  • If the string is a valid email address, returns the email address, otherwise, return nil.

    Declaration

    Swift

    public func validateAsEmail() -> String?
  • Parse JSON string to an array. Returns nil if cannot be parsed to an array.

    Declaration

    Swift

    public func toArray() -> [Any]?