Skip to content
This repository has been archived by the owner on Dec 19, 2023. It is now read-only.

Commit

Permalink
Update strapdown-server.go
Browse files Browse the repository at this point in the history
  • Loading branch information
yywing authored Mar 20, 2017
1 parent 3495d77 commit 0c15bd4
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions server/strapdown-server.go
Original file line number Diff line number Diff line change
Expand Up @@ -378,6 +378,7 @@ func UnicodeIndex(str, substr string) int {
}
return result
}

//字符串匹配
func searchStr(files []string, key string, suffix string, prefix string) (searchs []byte, err error) {
var jsondata []SearchResult
Expand All @@ -389,8 +390,8 @@ func searchStr(files []string, key string, suffix string, prefix string) (search
con, _ := ioutil.ReadAll(f)
str := string(con[:])
f.Close()
if strings.Contains(strings.ToLower(str),strings.ToLower(key)) {
pos := UnicodeIndex(strings.ToLower(str),strings.ToLower(key))
if strings.Contains(strings.ToLower(str), strings.ToLower(key)) {
pos := UnicodeIndex(strings.ToLower(str), strings.ToLower(key))
t := Substr(str, pos-15, 30)
searchfile := strings.TrimSuffix(files[i], suffix)
searchfile = strings.TrimPrefix(searchfile, prefix)
Expand Down

0 comments on commit 0c15bd4

Please sign in to comment.