func splitKws(s string, kws []string) []word {
	result := []word{{txt: s}}
	for _, kw := range kws {
		tmp := make([]word, 0)
		for _, w := range result {
			if w.highlight {
				tmp = append(tmp, w)
				continue
			}
			parts := strings.Split(w.txt, kw)
			for i, part := range parts {
				if i > 0 {
					tmp = append(tmp, word{txt: kw, highlight: true})
				}
				if len(part) > 0 {
					tmp = append(tmp, word{txt: part, highlight: false})
				}
			}
		}
		result = tmp
	}
	return result
}
// split the specified string with kws
split the specified string with kws
// split the specified string with kws
func splitKws(s string, kws []string) []word {
	result := []word{{txt: s}}
	for _, kw := range kws {
		tmp := make([]word, 0)
		for _, w := range result {
			if w.highlight {
				tmp = append(tmp, w)
				continue
			}
			parts := strings.Split(w.txt, kw)
			for i, part := range parts {
				if i > 0 {
					tmp = append(tmp, word{txt: kw, highlight: true})
				}
				if len(part) > 0 {
					tmp = append(tmp, word{txt: part, highlight: false})
				}
			}
		}
		result = tmp
	}
	return result
}
func splitKws ( s string , kws [ ] string ) [ ] word { result := [ ] word { { txt : s } } for _ , kw := range kws { tmp := make ( [ ] word , 0 ) for _ , w := range result { if w . highlight { tmp = append ( tmp , w ) continue } parts := strings . Split ( w . txt , kw ) for i , part := range parts { if i > 0 { tmp = append ( tmp , word { txt : kw , highlight : true } ) } if len ( part ) > 0 { tmp = append ( tmp , word { txt : part , highlight : false } ) } } } result = tmp } return result }
split the specified string with kws
split the specified string with kws