【发布时间】:2015-01-28 16:18:24
【问题描述】:
我在一个列表中存储了一组字符串。我遍历列表以与字符串"[the]" 进行比较。
当我使用函数strings.EqualFold时,它会出现这个错误:
不能在函数参数中使用 e.Value (type interface {}) 作为类型字符串:需要类型断言
代码如下:
for e := l.Front(); e != nil; e = e.Next() {
if(strings.EqualFold("[the]", e.Value)){
count++
}
}
【问题讨论】:
-
不使用链表?有什么理由不能使用切片?
标签: go