string.go
func StringStripHTMLTags(text string) (plainText string) {
	var buf *bytes.Buffer
	tagClose := -1
	tagStart := -1
	for i, char := range text {
		if char == '<' {
			if buf == nil {
				buf = bytes.NewBufferString(text)
				buf.Reset()
			}
			buf.WriteString(text[tagClose+1 : i])
			tagStart = i
		} else if char == '>' && tagStart != -1 {
			tagClose = i
			tagStart = -1
		}
	}
	if buf == nil {
		return text
	}
	buf.WriteString(text[tagClose+1:])
	return buf.String()
}
func StringStripHTMLTags(text string) (plainText string) {
	var buf *bytes.Buffer
	tagClose := -1
	tagStart := -1
	for i, char := range text {
		if char == '<' {
			if buf == nil {
				buf = bytes.NewBufferString(text)
				buf.Reset()
			}
			buf.WriteString(text[tagClose+1 : i])
			tagStart = i
		} else if char == '>' && tagStart != -1 {
			tagClose = i
			tagStart = -1
		}
	}
	if buf == nil {
		return text
	}
	buf.WriteString(text[tagClose+1:])
	return buf.String()
}
func StringStripHTMLTags ( text string ) ( plainText string ) { var buf * bytes . Buffer tagClose := - 1 tagStart := - 1 for i , char := range text { if char == '<' { if buf == nil { buf = bytes . NewBufferString ( text ) buf . Reset ( ) } buf . WriteString ( text [ tagClose + 1 : i ] ) tagStart = i } else if char == '>' && tagStart != - 1 { tagClose = i tagStart = - 1 } } if buf == nil { return text } buf . WriteString ( text [ tagClose + 1 : ] ) return buf . String ( ) }
// StringStripHTMLTags strips HTML/XML tags from text.
StringStripHTMLTags strips HTML / XML tags from text .