You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
21 lines
376 B
21 lines
376 B
2 years ago
|
package docstract
|
||
|
|
||
|
//StripSeperators removes all the random 0 bytes
|
||
|
func StripSeperators(s string) string {
|
||
|
iBytes := []byte(s)
|
||
|
oBytes := []byte{}
|
||
|
|
||
|
if len(iBytes) >= 3 {
|
||
|
offset := 0
|
||
|
if iBytes[0] == iBytes[2] && iBytes[0] == byte(0) {
|
||
|
offset = 1
|
||
|
}
|
||
|
|
||
|
for i := offset; i < len(iBytes); i += 2 {
|
||
|
oBytes = append(oBytes, iBytes[i])
|
||
|
}
|
||
|
}
|
||
|
|
||
|
return string(oBytes)
|
||
|
}
|