func EncloseToken(text, token, leftcap, rightcap []byte) (
	newtext []byte,
	found bool,
) {
	enclosedLen := len(token)
	startat := 0
	for {
		foundat := TokenFind(text, token, startat)
		if foundat < 0 {
			newtext = append(newtext, text[startat:]...)
			break
		}
		newtext = append(newtext, text[startat:foundat]...)
		newtext = append(newtext, leftcap...)
		newtext = append(newtext, token...)
		newtext = append(newtext, rightcap...)
		startat = foundat + enclosedLen
	}
	if startat > 0 {
		found = true
	}
	return newtext, found
}
EncloseToken find "token" in "text" and enclose it with bytes from
"leftcap" and "rightcap".
If at least one token found, it will return modified text with true status.
If no token is found, it will return the same text with false status.
package bytes
import (
	"bytes"
	"fmt"
	"unicode"
)
func AppendInt16(data []byte, v int16) []byte {
	data = append(data, byte(v>>8))
	data = append(data, byte(v))
	return data
}
func AppendInt32(data []byte, v int32) []byte {
	data = append(data, byte(v>>24))
	data = append(data, byte(v>>16))
	data = append(data, byte(v>>8))
	data = append(data, byte(v))
	return data
}
func AppendUint16(data []byte, v uint16) []byte {
	data = append(data, byte(v>>8))
	data = append(data, byte(v))
	return data
}
func AppendUint32(data []byte, v uint32) []byte {
	data = append(data, byte(v>>24))
	data = append(data, byte(v>>16))
	data = append(data, byte(v>>8))
	data = append(data, byte(v))
	return data
}
func Concat(args ...interface{}) (out []byte) {
	for _, arg := range args {
		switch v := arg.(type) {
		case string:
			out = append(out, []byte(v)...)
		case []byte:
			out = append(out, v...)
		}
	}
	return out
}
func Copy(src []byte) (dst []byte) {
	if len(src) == 0 {
		return
	}
	dst = make([]byte, len(src))
	copy(dst, src)
	return
}
func CutUntilToken(text, token []byte, startAt int, checkEsc bool) (cut []byte, pos int, found bool) {
	var isEsc bool
	textlen := len(text)
	tokenlen := len(token)
	if tokenlen == 0 {
		return text, -1, false
	}
	if startAt < 0 {
		startAt = 0
	}
	for pos = startAt; pos < textlen; pos++ {
		if checkEsc && text[pos] == '\\' {
			if isEsc {
				cut = append(cut, '\\')
				isEsc = false
			} else {
				isEsc = true
			}
			continue
		}
		if text[pos] != token[0] {
			if isEsc {
				cut = append(cut, '\\')
				isEsc = false
			}
			cut = append(cut, text[pos])
			continue
		}
		found = IsTokenAt(text, token, pos)
		if !found {
			if isEsc {
				cut = append(cut, '\\')
				isEsc = false
			}
			cut = append(cut, text[pos])
			continue
		}
		if isEsc {
			cut = append(cut, token...)
			pos = pos + tokenlen - 1
			isEsc = false
			continue
		}
		return cut, pos + tokenlen, true
	}
	return cut, pos, false
}
func EncloseRemove(text, leftToken, rightToken []byte) (cut []byte, found bool) {
	lidx := TokenFind(text, leftToken, 0)
	if lidx < 0 {
		return text, false
	}
	ridx := TokenFind(text, rightToken, lidx+1)
	if ridx < 0 {
		return text, false
	}
	cut = make([]byte, 0, len(text[:lidx])+len(text[ridx:]))
	cut = append(cut, text[:lidx]...)
	cut = append(cut, text[ridx+len(rightToken):]...)
	cut, _ = EncloseRemove(cut, leftToken, rightToken)
	return cut, true
}