2 Star 15 Fork 10

北京小程科技有限公司/Go通用工具

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
find.go 354 Bytes
一键复制 编辑 原始数据 按行查看 历史
shallot 提交于 2020-03-11 01:49 +08:00 . 添加查找字符串的方法。
package basic
import (
"strings"
)
func IndexOfString(arr []string, target string) int {
for i, item := range arr {
if strings.Compare(item, target) == 0 {
return i
}
}
return -1
}
func IndexOfNoCaseString(arr []string, target string) int {
for i, item := range arr {
if strings.EqualFold(item, target) {
return i
}
}
return -1
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Go
1
https://gitee.com/xiaochengtech/common.git
git@gitee.com:xiaochengtech/common.git
xiaochengtech
common
Go通用工具
82269be32710

搜索帮助