@@ -561,7 +561,7 @@ func SliceRemoveCallback(length int, callback func(int) func(bool) error) error
561561
562562func SplitKVRows (rows string , seperator ... string ) map [string ]string {
563563 sep := `=`
564- if len (seperator ) > 0 {
564+ if len (seperator ) > 0 && len ( seperator [ 0 ]) > 0 {
565565 sep = seperator [0 ]
566566 }
567567 res := map [string ]string {}
@@ -582,7 +582,7 @@ func SplitKVRows(rows string, seperator ...string) map[string]string {
582582
583583func SplitKVRowsCallback (rows string , callback func (k , v string ) error , seperator ... string ) (err error ) {
584584 sep := `=`
585- if len (seperator ) > 0 {
585+ if len (seperator ) > 0 && len ( seperator [ 0 ]) > 0 {
586586 sep = seperator [0 ]
587587 }
588588 for _ , row := range strings .Split (rows , StrLF ) {
@@ -604,8 +604,9 @@ func SplitKVRowsCallback(rows string, callback func(k, v string) error, seperato
604604}
605605
606606func TrimSpaceForRows (rows string ) []string {
607- res := []string {}
608- for _ , row := range strings .Split (rows , StrLF ) {
607+ rows := strings .Split (rows , StrLF )
608+ res := make ([]string , 0 , len (rows ))
609+ for _ , row := range rows {
609610 row = strings .TrimSpace (row )
610611 if len (row ) == 0 {
611612 continue
0 commit comments