This commit is contained in:
2018-11-04 15:58:15 +01:00
commit f956bcee28
1178 changed files with 584552 additions and 0 deletions

17
vendor/github.com/asticode/go-astitools/byte/length.go generated vendored Normal file
View File

@ -0,0 +1,17 @@
package astibyte
// ToLength forces the length of a []byte
func ToLength(i []byte, rpl byte, length int) []byte {
if len(i) == length {
return i
} else if len(i) > length {
return i[:length]
} else {
var o = make([]byte, length)
o = i
for idx := 0; idx < length-len(i); idx++ {
o = append(o, rpl)
}
return o
}
}

29
vendor/github.com/asticode/go-astitools/byte/pad.go generated vendored Normal file
View File

@ -0,0 +1,29 @@
package astibyte
// PadLeft adds n rpl to the left of i so that len is length
func PadLeft(i []byte, rpl byte, length int) []byte {
if len(i) >= length {
return i
} else {
var o = make([]byte, length)
o = i
for idx := 0; idx < length-len(i); idx++ {
o = append([]byte{rpl}, o...)
}
return o
}
}
// PadRight adds n rpl to the right of i so that len is length
func PadRight(i []byte, rpl byte, length int) []byte {
if len(i) >= length {
return i
} else {
var o = make([]byte, length)
o = i
for idx := 0; idx < length-len(i); idx++ {
o = append(o, rpl)
}
return o
}
}