func Decision() {
if ArrowType.index(ArrowType.startIndex, offsetBy: 3) == "<" {
UserChoice = "L"
} else if {ArrowType.index(ArrowType.startIndex, offsetBy: 3) == ">"
UserChoice = "R"
}
}
二进制运算符'=='不能应用于类型为'String.Index'和'String'的操作数
答案 0 :(得分:0)
ArrowType.index(ArrowType.startIndex,offsetBy:3)将返回索引值。使用以下代码获取该索引的值:
ArrowType[ArrowType.index(ArrowType.startIndex, offsetBy: 3)]