simplify ranges

This commit is contained in:
Erik Little 2017-11-23 11:37:31 -05:00
parent 11bc8e5df2
commit f0ac68e369
No known key found for this signature in database
GPG Key ID: 4930B7C5FBC1A69D
2 changed files with 2 additions and 2 deletions

View File

@ -119,7 +119,7 @@ public extension SocketParsable where Self: SocketManagerSpec & SocketDataBuffer
}
}
var dataArray = String(message.utf16[message.utf16.index(reader.currentIndex, offsetBy: 1)..<message.utf16.endIndex])!
var dataArray = String(message.utf16[message.utf16.index(reader.currentIndex, offsetBy: 1)...])!
if type == .error && !dataArray.hasPrefix("[") && !dataArray.hasSuffix("]") {
dataArray = "[" + dataArray + "]"

View File

@ -54,7 +54,7 @@ struct SocketStringReader {
}
mutating func readUntilOccurence(of string: String) -> String {
let substring = message.utf16[currentIndex..<message.utf16.endIndex]
let substring = message.utf16[currentIndex...]
guard let foundIndex = substring.index(of: string.utf16.first!) else {
currentIndex = message.utf16.endIndex