Skip to content

Instantly share code, notes, and snippets.

@iljaiwas
Created March 2, 2018 15:31
Show Gist options
  • Save iljaiwas/5fab5b1179c58a1bb1014e915e0f8ec0 to your computer and use it in GitHub Desktop.
Save iljaiwas/5fab5b1179c58a1bb1014e915e0f8ec0 to your computer and use it in GitHub Desktop.
Swift Data Ranges
import Cocoa
var str = "01234567890123456789012345678901234567"
var buffer = Data()
if let data = str.data(using: .utf8) {
buffer.append(data)
buffer = buffer[15..<38]
buffer = buffer[2..<23]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment