Skip to content

Instantly share code, notes, and snippets.

@nsomar
Created June 3, 2016 08:19
Show Gist options
  • Save nsomar/04915deac33bb8b72a50880bc4021e49 to your computer and use it in GitHub Desktop.
Save nsomar/04915deac33bb8b72a50880bc4021e49 to your computer and use it in GitHub Desktop.
Inset a string one character from start and end
let string = "This is the string"
let start = string.index(string.startIndex, offsetBy: 1)
let end = string.index(string.endIndex, offsetBy: -1)
string[start..<end]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment