jjzjj

CountablePartialRangeFrom

全部标签

swift 4 : Cannot subscript a value of type 'String' with an index of type 'CountablePartialRangeFrom<Int>'

所以我有这个快速代码:funcdidReceiveResponse(response:String){...letsubstr=response[11...]根据我的解释,substr应该是Substring引用响应字符串中索引11之后的所有字符。实际发生的是这个编译器错误:Cannotsubscriptavalueoftype'String'withanindexoftype'CountablePartialRangeFrom'这看起来应该是显而易见的,有人可以帮忙吗? 最佳答案 糟糕。看来我只需要这样做:letidx=respo

swift 4 : Cannot subscript a value of type 'String' with an index of type 'CountablePartialRangeFrom<Int>'

所以我有这个快速代码:funcdidReceiveResponse(response:String){...letsubstr=response[11...]根据我的解释,substr应该是Substring引用响应字符串中索引11之后的所有字符。实际发生的是这个编译器错误:Cannotsubscriptavalueoftype'String'withanindexoftype'CountablePartialRangeFrom'这看起来应该是显而易见的,有人可以帮忙吗? 最佳答案 糟糕。看来我只需要这样做:letidx=respo