Created
June 23, 2016 11:27
-
-
Save albertodebortoli/be8c8fddcebb5a44b3195e9782ffc5e1 to your computer and use it in GitHub Desktop.
swift 3.0 substring
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 s: String = "Stack Overflow" | |
let ss1: String = (s as NSString).substring(to: 5) // "Stack" | |
let index: String.Index = s.index(s.startIndex, offsetBy: 5) | |
var ss2: String = s.substring(to: index) // "Stack" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment