类型“ String._CharacterView.Index”(又名“ String.Index”)不符合协议“ FixedWidthInteger”

时间:2019-02-22 01:44:11

标签: swift

我设法解决了许多错误,但是我无法使此功能正常工作。

// Substring
func substring(_ start: Int, end: Int) -> String {
    return self.substring(with: NSRange(self.characters.index(self.startIndex, offsetBy: start) ..< self.characters.index(self.startIndex, offsetBy: end)))
    // error here "Type 'String._CharacterView.Index' (aka 'String.Index') does not conform to protocol 'FixedWidthInteger'"
} 

0 个答案:

没有答案