-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathutils.go
More file actions
38 lines (31 loc) · 661 Bytes
/
utils.go
File metadata and controls
38 lines (31 loc) · 661 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
package ts3
import (
"strconv"
"strings"
)
var (
// encoder performs white space and special character encoding
// as required by the ServerQuery protocol.
encoder = strings.NewReplacer(
` `, `+`,
)
webEncoder = strings.NewReplacer(
` `, `%20`,
`=`, `%3D`,
)
// decoder performs white space and special character decoding
// as required by the ServerQuery protocol.
decoder = strings.NewReplacer(
`+`, " ",
)
)
func Encode(s string) string {
return encoder.Replace(s)
}
func WebEncode(s string) string {
return webEncoder.Replace(s)
}
// Converts int64 to a string
func i64tostr(i int64) string {
return strconv.FormatInt(i, 10)
}