Introduce 'splitByNewline' string extension
This commit is contained in:
parent
2ffc9ba568
commit
56b2205376
3 changed files with 9 additions and 9 deletions
|
|
@ -17,6 +17,10 @@ extension String {
|
|||
allowed.insert(charactersIn: unreserved)
|
||||
return addingPercentEncoding(withAllowedCharacters: allowed)
|
||||
}
|
||||
|
||||
public func splitByNewline() -> [String] {
|
||||
return split(omittingEmptySubsequences: false) { $0 == "\n" || $0 == "\r\n" }.map(String.init)
|
||||
}
|
||||
}
|
||||
|
||||
extension String {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue