In Objective-c we create range by using NSRange
NSRange range;
So how to create range in Swift?
Use like this
var start = str.startIndex // Start at the string's start index
var end = advance(str.startIndex, 5) // Take start index and advance 5 characters forward
var range: Range = Range(start: start,end: end)
let firstFiveDigit = str.substringWithRange(range)
print(firstFiveDigit)
Output : Hello