mirror of https://github.com/oxen-io/session-ios
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
24 lines
538 B
Swift
24 lines
538 B
Swift
5 years ago
|
//
|
||
|
// String+Lines.swift
|
||
|
// SwiftCSV
|
||
|
//
|
||
|
// Created by Naoto Kaneko on 2/24/16.
|
||
|
// Copyright © 2016 Naoto Kaneko. All rights reserved.
|
||
|
//
|
||
|
|
||
|
extension String {
|
||
|
internal var firstLine: String {
|
||
|
var current = startIndex
|
||
|
while current < endIndex && self[current].isNewline == false {
|
||
|
current = self.index(after: current)
|
||
|
}
|
||
|
return String(self[..<current])
|
||
|
}
|
||
|
}
|
||
|
|
||
|
extension Character {
|
||
|
internal var isNewline: Bool {
|
||
|
return self == "\n" || self == "\r\n" || self == "\r"
|
||
|
}
|
||
|
}
|