Skip to content

Commit

Permalink
修复纯真ip2region分隔符显示问题
Browse files Browse the repository at this point in the history
  • Loading branch information
fcwys committed Jul 11, 2024
1 parent 5b05dfb commit 6c9b5a7
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions pkg/ip2region/ip2region.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,10 @@ func NewIp2Region(filePath string) (*Ip2Region, error) {

func (db Ip2Region) Find(query string, params ...string) (result fmt.Stringer, err error) {
if db.seacher != nil {
res, err := db.seacher.SearchByStr(query)
res=strings.ReplaceAll(res, "|", " ")
res=strings.ReplaceAll(res, "\t", " ")
res, err := db.seacher.SearchByStr(query)
res = strings.ReplaceAll(res, "|", " ") //替换分割符为空格
res = strings.ReplaceAll(res, "\t", " ") //替换制表符为空格
res = strings.ReplaceAll(res, "–", " ") //替换纯真分隔符为空格
if err != nil {
return nil, err
} else {
Expand Down

0 comments on commit 6c9b5a7

Please sign in to comment.