代码之家  ›  专栏  ›  技术社区  ›  Nikola Lukic

“…”不是后缀一元运算符-Swift 3

  •  2
  • Nikola Lukic  · 技术社区  · 8 年前

    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 回复  |  直到 8 年前
        1
  •  6
  •   Tj3n    8 年前

    使用其中一个 ... ..< (半近距,最后一次),没有什么比 ... <

        2
  •  4
  •   Naresh    7 年前

    0..<

    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#>)
        }