mirror of
https://github.com/lionsoul2014/ip2region.git
synced 2025-12-08 19:25:22 +00:00
trim the space to input segment
This commit is contained in:
parent
7ff7772e14
commit
8e3c440ada
@ -16,7 +16,7 @@ type Segment struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func SegmentFrom(seg string) (*Segment, error) {
|
func SegmentFrom(seg string) (*Segment, error) {
|
||||||
var ps = strings.SplitN(seg, "|", 3)
|
var ps = strings.SplitN(strings.TrimSpace(seg), "|", 3)
|
||||||
if len(ps) != 3 {
|
if len(ps) != 3 {
|
||||||
return nil, fmt.Errorf("invalid ip segment `%s`", seg)
|
return nil, fmt.Errorf("invalid ip segment `%s`", seg)
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user