swift Range init函数错误

swift Range init函数错误,swift,Swift,我的代码 self.p_formatterTime = self.pubTime?.substringWithRange(Range<Int>(start: 5, end: 11)) self.p_formatterTime=self.pubTime?.substringWithRange(范围(开始:5,结束:11)) 编译错误消息: Cannot invoke initializer for type 'Range<Int>' with an argument l

我的代码

self.p_formatterTime = self.pubTime?.substringWithRange(Range<Int>(start: 5, end: 11))
self.p_formatterTime=self.pubTime?.substringWithRange(范围(开始:5,结束:11))
编译错误消息:

Cannot invoke initializer for type 'Range<Int>' with an argument list of type '(start: Int, end: Int)'
无法使用类型为“(start:Int,end:Int)”的参数列表调用类型“Range”的初始值设定项
如何修复

if let a = self.pubTime {
    self.p_formatterTime = a.substringWithRange(Range<String.Index>(start: a.startIndex.advancedBy(5), end: a.startIndex.advancedBy(11)))
    // ...
}
let myString = "0123456789ABCDEFG"
let mySubString = myString.substringWithRange(Range<String.Index>(start: myString.startIndex.advancedBy(5), end: myString.startIndex.advancedBy(11)))
print(mySubString) // prints "56789A"