Пример #1
0
func ss(str *utf8string.String, pos, length int) string {
	p0, p1 := pos, pos+length
	if p0 < 0 {
		p0 = 0
	}
	l := p1 - p0
	if p1 > str.RuneCount() {
		p1 = str.RuneCount()
	}
	s := str.Slice(p0, p1)
	if l > (p1 - p0) {
		s = s + strings.Repeat(" ", l-(p1-p0))
	}
	return s
}