Skip to content

Commit

Permalink
split multiple delimiter
Browse files Browse the repository at this point in the history
  • Loading branch information
axiaoxin committed Jul 16, 2021
1 parent 1dd7fb4 commit 09126c6
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ require (
github.com/360EntSecGroup-Skylar/excelize/v2 v2.4.0
github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751
github.com/avast/retry-go v3.0.0+incompatible
github.com/axiaoxin-com/goutils v1.0.19
github.com/axiaoxin-com/goutils v1.0.20-0.20210716041855-3e573fda9d16
github.com/axiaoxin-com/logging v1.2.11-0.20210710005236-5a960a1422ba
github.com/axiaoxin-com/ratelimiter v1.0.3
github.com/deckarep/golang-set v1.7.1
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,8 @@ github.com/axiaoxin-com/goutils v1.0.18-0.20210716022755-adca40994719 h1:khnOQaI
github.com/axiaoxin-com/goutils v1.0.18-0.20210716022755-adca40994719/go.mod h1:5TkHWwl5j2M2u4vFDxtelwB4Ts7JgyfpRJrs8v19+VM=
github.com/axiaoxin-com/goutils v1.0.19 h1:Y+jXz7v8Ax1o7SY1UOPX+NfCTq/GIljSACZRNvOif/o=
github.com/axiaoxin-com/goutils v1.0.19/go.mod h1:5TkHWwl5j2M2u4vFDxtelwB4Ts7JgyfpRJrs8v19+VM=
github.com/axiaoxin-com/goutils v1.0.20-0.20210716041855-3e573fda9d16 h1:cqFGKPcp9mVEJuD8FwVJFGM6ubIFJJ27qqzssfedQfE=
github.com/axiaoxin-com/goutils v1.0.20-0.20210716041855-3e573fda9d16/go.mod h1:5TkHWwl5j2M2u4vFDxtelwB4Ts7JgyfpRJrs8v19+VM=
github.com/axiaoxin-com/logging v1.2.3/go.mod h1:WM8Q9JLUi1jDh51XirUBDn8QXkxc8AO2oApFXHiEXf4=
github.com/axiaoxin-com/logging v1.2.11-0.20210710005236-5a960a1422ba h1:cAErRDYhJOQr4MWHIBKYn5WI+/qnxTa41ycLyenreUE=
github.com/axiaoxin-com/logging v1.2.11-0.20210710005236-5a960a1422ba/go.mod h1:Jx322YD47doa/j9kn3pNPntze8b9bOVxf3So0LmdRMg=
Expand Down
6 changes: 2 additions & 4 deletions routes/fund.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ package routes

import (
"net/http"
"regexp"
"strings"
"sync"

"github.com/axiaoxin-com/goutils"
Expand Down Expand Up @@ -204,7 +202,7 @@ func FundCheck(c *gin.Context) {
return
}

codes := strings.Split(p.Code, "/")
codes := goutils.SplitStringFields(p.Code)
searcher := core.NewSearcher(c)
funds, err := searcher.SearchFunds(c, codes)
if err != nil {
Expand Down Expand Up @@ -302,7 +300,7 @@ func FundSimilarity(c *gin.Context) {
c.HTML(http.StatusOK, "fund_similarity.html", data)
return
}
codeList := regexp.MustCompile("[\\/\\:\\,\\;\\.\\s]+").Split(p.Codes, -1)
codeList := goutils.SplitStringFields(p.Codes)
checker := core.NewChecker(c, core.DefaultCheckerOptions)
result, err := checker.GetFundStocksSimilarity(c, codeList)
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion routes/stock.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ func StockChecker(c *gin.Context) {
return
}
searcher := core.NewSearcher(c)
keywords := strings.Split(param.Keyword, "/")
keywords := goutils.SplitStringFields(param.Keyword)
stocks, err := searcher.SearchStocks(c, keywords)
if err != nil {
data["Error"] = err.Error()
Expand Down

0 comments on commit 09126c6

Please sign in to comment.