forked from digisan/json-tool
-
Notifications
You must be signed in to change notification settings - Fork 0
/
var.go
42 lines (37 loc) · 893 Bytes
/
var.go
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
39
40
41
42
package jsontool
import (
"fmt"
"regexp"
"strings"
lk "github.com/digisan/logkit"
)
var (
fPln = fmt.Println
fSf = fmt.Sprintf
fEf = fmt.Errorf
sSplit = strings.Split
sJoin = strings.Join
sTrim = strings.Trim
sTrimLeft = strings.TrimLeft
sTrimRight = strings.TrimRight
sReplaceAll = strings.ReplaceAll
sIndex = strings.Index
sLastIndex = strings.LastIndex
sHasPrefix = strings.HasPrefix
sHasSuffix = strings.HasSuffix
rxMustCompile = regexp.MustCompile
failOnErr = lk.FailOnErr
failOnErrWhen = lk.FailOnErrWhen
sTrimPrefix = strings.TrimPrefix
sTrimSuffix = strings.TrimSuffix
)
var (
DEBUG = 0
)
// dropCR drops a terminal \r from the data.
var dropCR = func(data []byte) []byte {
if len(data) > 0 && data[len(data)-1] == '\r' {
return data[0 : len(data)-1]
}
return data
}