Objective-C
NSString * string = @"Objective-C"
NSString * substring = [string substringToIndex: 3];
Swift 2.0
let string = "Swift 2.0"
let substring = string.substringToIndex( string.startIndex.advancedBy( 3 ) )
Swift 1.2
let string = "Swift 1.2"
let substring = string.substringToIndex( advance( string.startIndex, 3 ) )