Skip to content

Commit

Permalink
fix find word issue
Browse files Browse the repository at this point in the history
  • Loading branch information
nb857 committed Feb 17, 2021
1 parent 2e488e5 commit 1e9e55f
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion utils/word.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ func NewFindItemsResult(words []string, ret string) *FindItemsResult {
rets := strings.Split(ret, "|")

f := &FindItemsResult{}
if len(rets) == 0 {
return f
}

for _, item := range rets {
item = strings.Replace(item, ",", "|", -1)
f.Items = append(f.Items, NewFindItemResult(words, item))
Expand All @@ -36,8 +40,12 @@ type FindItemResult struct {

func NewFindItemResult(words []string, ret string) *FindItemResult {
rets := strings.Split(ret, "|")

f := &FindItemResult{}

if len(rets) == 0 {
return f
}

f.Index, _ = strconv.Atoi(rets[0])
if f.Index == -1 {
return f
Expand Down

0 comments on commit 1e9e55f

Please sign in to comment.