gpt4 book ai didi

Swift 2.2 - 类型 'String' 的值没有成员 'contains'

转载 作者:行者123 更新时间:2023-11-30 10:03:03 28 4
gpt4 key购买 nike

我正在使用 swift 2.2 并收到错误 Value of type 'String' has no member 'contains',这与 swift 2.1 中的情况相同。如果 contains 方法在 swift 2.2 中被弃用或删除,任何人都可以帮忙。

代码

var another = "Test"
another.contains("we")

错误:

Value of type 'String' has no member 'contains'

最佳答案

用途:

another.containsString("we")

你会用到:

import Foundation

在您的代码中 containsString

关于Swift 2.2 - 类型 'String' 的值没有成员 'contains',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37436649/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com