Added validation before saving any tunnels
Signed-off-by: Eric Kuck <eric@bluelinelabs.com>
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
//
|
||||
// String+Arrays.swift
|
||||
// WireGuard
|
||||
//
|
||||
// Created by Eric Kuck on 8/15/18.
|
||||
// Copyright © 2018 Jason A. Donenfeld <Jason@zx2c4.com>. All rights reserved.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
extension String {
|
||||
|
||||
static func commaSeparatedStringFrom(elements: [String]) -> String {
|
||||
return elements.joined(separator: ",")
|
||||
}
|
||||
|
||||
func commaSeparatedToArray() -> [String] {
|
||||
return components(separatedBy: .whitespaces)
|
||||
.joined()
|
||||
.split(separator: ",")
|
||||
.map(String.init)
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user