diff options
author | rsiddharth <s@ricketyspace.net> | 2020-09-06 22:05:04 -0400 |
---|---|---|
committer | rsiddharth <s@ricketyspace.net> | 2020-09-06 22:05:04 -0400 |
commit | 6edba5b98e7eba30e5dd3af2bf997e6c42719fde (patch) | |
tree | a312299b808eb715f2ad06792d0c881be74b0f1a | |
parent | 52f09ad3da9d8d11abef07c85179ac52b5bed842 (diff) |
lib: add FillBytes
* lib/str.go (FillBytes): New function.
-rw-r--r-- | lib/str.go | 11 |
1 files changed, 11 insertions, 0 deletions
@@ -14,6 +14,17 @@ func FillStr(a string, l int) string { return b } +func FillBytes(c byte, l int) []byte { + if l < 1 { + return make([]byte, 0) + } + bs := make([]byte, l) + for i := 0; i < l; i++ { + bs[i] = c + } + return bs +} + // Strip space and newline characters from string. func stripSpaceChars(s string) string { ss := "" |