wireguard-apple/WireGuard/Extensions/String+Base64.swift

19 lines
366 B
Swift
Raw Normal View History

//
// String+Base64.swift
// WireGuard
//
// Created by Eric Kuck on 8/15/18.
// Copyright © 2018 WireGuard LLC. All rights reserved.
//
import Foundation
extension String {
func isBase64() -> Bool {
2018-09-26 09:23:13 +00:00
let base64Predicate = NSPredicate(format: "SELF MATCHES %@", "^[a-zA-Z0-9+/]{43}=$")
return base64Predicate.evaluate(with: self)
}
}