mirror of
https://github.com/gin-gonic/gin.git
synced 2025-10-14 20:22:20 +08:00
refactor: use strings.Cut to replace strings.Index
This commit is contained in:
parent
b4f66e965b
commit
e04015f552
@ -377,11 +377,8 @@ func setTimeDuration(val string, value reflect.Value) error {
|
||||
}
|
||||
|
||||
func head(str, sep string) (head string, tail string) {
|
||||
idx := strings.Index(str, sep)
|
||||
if idx < 0 {
|
||||
return str, ""
|
||||
}
|
||||
return str[:idx], str[idx+len(sep):]
|
||||
head, tail, _ = strings.Cut(str, sep)
|
||||
return head, tail
|
||||
}
|
||||
|
||||
func setFormMap(ptr any, form map[string][]string) error {
|
||||
|
Loading…
x
Reference in New Issue
Block a user