yattee/Extensions/String+Format.swift
2021-09-26 22:12:43 +02:00

12 lines
321 B
Swift

import Foundation
extension String {
var serializationSafe: String {
let serializationUnsafe = ":;"
let forbidden = CharacterSet(charactersIn: serializationUnsafe)
let result = unicodeScalars.filter { !forbidden.contains($0) }
return String(String.UnicodeScalarView(result))
}
}