2018-08-15 22:34:16 +00:00
|
|
|
//
|
|
|
|
// String+Arrays.swift
|
|
|
|
// WireGuard
|
|
|
|
//
|
|
|
|
// Created by Eric Kuck on 8/15/18.
|
2018-09-06 05:42:23 +00:00
|
|
|
// Copyright © 2018 WireGuard LLC. All rights reserved.
|
2018-08-15 22:34:16 +00:00
|
|
|
//
|
|
|
|
|
|
|
|
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)
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|