Skip to content

Commit e10bc75

Browse files
committed
chore: use strings.Contains and strings.ContainsRune instead strings.Index
Signed-off-by: guoguangwu <guoguangwug@gmail.com>
1 parent 2b3f02d commit e10bc75

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

baselib.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -410,7 +410,7 @@ func baseToNumber(L *LState) int {
410410
L.Push(lv)
411411
case LString:
412412
str := strings.Trim(string(lv), " \n\t")
413-
if strings.Index(str, ".") > -1 {
413+
if strings.ContainsRune(str, '.') {
414414
if v, err := strconv.ParseFloat(str, LNumberBit); err != nil {
415415
L.Push(LNil)
416416
} else {

parse/lexer.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -512,7 +512,7 @@ func dump(node interface{}, level int, s string) string {
512512
tt := rt.Elem()
513513
indicies := []int{}
514514
for i := 0; i < tt.NumField(); i++ {
515-
if strings.Index(tt.Field(i).Name, "Base") > -1 {
515+
if strings.Contains(tt.Field(i).Name, "Base") {
516516
continue
517517
}
518518
indicies = append(indicies, i)

0 commit comments

Comments
 (0)