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

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/45612782/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-15 10:10:52  来源:igfitidea点击:

'...' is not a postfix unary operator - Swift 3

iosxcodeswift3

提问by Nikola Lukic

I just want to remove one part of string .

我只想删除 string 的一部分。

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 

   }

回答by Tj3n

Use either ...(close range) or ..<(half close range, before last), there's nothing like ... <

使用...(close range) 或..<(half close range, before last),没有什么比... <

回答by iOS

In my case i given space between 0..<and dictionary.count

在我的情况下,我在0..<dictionary.count之间给出了空间

Correct one is :

正确的一个是:

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