How is it possible to strip all UTF8 chars with more than 3 bytes?
I only want to support UTF8mb3
>Solution :
You can iterate and copy only those runes that are smaller than 4-bytes:
out:=make([]rune, 0, len(str))
for i:=0;i<len(str); {
r, n:=utf8.DecodeRune(str[i:])
if n<4 {
out=append(out,r)
}
i+=n
}
result:=string(out)