IOS-1561 extension for digits in string IOS-1561
authorXavier Algarra <xavier@pep-project.org>
Mon, 05 Aug 2019 16:34:16 +0200
branchIOS-1561
changeset 9539cbd1ed0f98f4
parent 9505 1427f0991b15
child 9540 56a1b52cae43
IOS-1561 extension for digits in string
pEpForiOS/Util/Extensions/String+Extension.swift
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/pEpForiOS/Util/Extensions/String+Extension.swift	Mon Aug 05 16:34:16 2019 +0200
     1.3 @@ -0,0 +1,18 @@
     1.4 +//
     1.5 +//  String+Extension.swift
     1.6 +//  pEp
     1.7 +//
     1.8 +//  Created by Xavier Algarra on 05/08/2019.
     1.9 +//  Copyright © 2019 p≡p Security S.A. All rights reserved.
    1.10 +//
    1.11 +
    1.12 +import Foundation
    1.13 +
    1.14 +extension String {
    1.15 +    var isDigits: Bool {
    1.16 +        guard !self.isEmpty else {
    1.17 +            return false
    1.18 +        }
    1.19 +        return self.contains { Int(String($0)) == nil }
    1.20 +    }
    1.21 +}