gpt4 book ai didi

ios - 我需要从索引 1 传递字符串值。我在 swift 1.2 中有代码,但我无法在 swift 3 中获得所需的输出

转载 作者:行者123 更新时间:2023-11-28 06:15:33 25 4
gpt4 key购买 nike

cString = cString.substring(from: advance(cString.startIndex, 1))

//我是 swift3 的新手,请建议我在 swift 3 中替换这一行。Xcode 无法转换这一行并给出错误,因为使用未解析的标识符提前..

最佳答案

swift 3.0

需要使用String方法index(_:offsetBy:)来推进索引:

let index = cString.index(cString.startIndex, offsetBy: 1)       
cString = cString.substring(from: index)

关于ios - 我需要从索引 1 传递字符串值。我在 swift 1.2 中有代码,但我无法在 swift 3 中获得所需的输出,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45229643/

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