Created
November 22, 2017 18:06
-
-
Save sirvon/80edd0c1ac4fb11d8f667feb2fdabee3 to your computer and use it in GitHub Desktop.
snipped from FTS4 for HYPERTRACK pod
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let view:String.UTF8View = string.utf8 | |
if let from = range.lowerBound.samePosition(in: view), | |
let to = range.upperBound.samePosition(in: view) { | |
offset.pointee += Int32(string[string.startIndex..<range.lowerBound].utf8.count) | |
length.pointee = Int32(view.distance(from: from, to: to)) | |
return token | |
} else { | |
return nil | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment