23 lines
400 B
Go
23 lines
400 B
Go
package main
|
|
|
|
import (
|
|
"strconv"
|
|
)
|
|
|
|
func getDisplayName(qba []byte) string {
|
|
if len(qba) ==0 {
|
|
return "<empty>"
|
|
}
|
|
|
|
ret := strconv.Quote(string(qba))
|
|
return ret[1 : len(ret)-1]
|
|
}
|
|
|
|
// ReverseSlice reverses a slice.
|
|
// @ref https://stackoverflow.com/a/28058324
|
|
func ReverseSlice[S ~[]E, E any](s S) {
|
|
for i, j := 0, len(s)-1; i < j; i, j = i+1, j-1 {
|
|
s[i], s[j] = s[j], s[i]
|
|
}
|
|
}
|