wireguard-apple/WireGuard/Extensions/String+Arrays.swift
Jeroen Leenarts 1379d97bbe Switch copyright assignment from Jason to WireGuard LLC.
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2018-09-06 07:42:23 +02:00

25 lines
505 B
Swift

//
// String+Arrays.swift
// WireGuard
//
// Created by Eric Kuck on 8/15/18.
// Copyright © 2018 WireGuard LLC. 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)
}
}