' ...'不是后缀一元运算符 - Swift 3

时间:2017-08-10 11:42:13

标签: ios xcode swift3

我只想删除一部分字符串。

if let dotRange = detailArticleContent?.range(of: "<iframe") {

    detailArticleContent.removeSubrange( dotRange.lowerBound... < detailArticleContent.endIndex )
    //In this line i got err : '...' is not a postfix unary operator 

   }

2 个答案:

答案 0 :(得分:5)

使用...(近距离)或..<(前一半的近距离),没有类似... <

的内容

答案 1 :(得分:1)

在我的情况下,我给了 0 .. << / strong>和 dictionary.count

之间的空格

正确的是:

0..<dictionary.count

//Wrong 
let dictionary = dic["predictions"] as! [String:Any]
    print(dictionary)
    for index in 0..< dictionary.count {
        print(<#T##items: Any...##Any#>)
    }

//Correct 
let dictionary = dic["predictions"] as! [String:Any]
    print(dictionary)
    for index in 0..<dictionary.count {
        print(<#T##items: Any...##Any#>)
    }