summaryrefslogtreecommitdiffstats
path: root/lib/str.go
diff options
context:
space:
mode:
Diffstat (limited to 'lib/str.go')
-rw-r--r--lib/str.go8
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/str.go b/lib/str.go
index 9112a14..c71762c 100644
--- a/lib/str.go
+++ b/lib/str.go
@@ -25,6 +25,14 @@ func FillBytes(c byte, l int) []byte {
return bs
}
+func StrToBytes(s string) []byte {
+ bs := make([]byte, len(s))
+ for i := 0; i < len(s); i++ {
+ bs[i] = byte(s[i])
+ }
+ return bs
+}
+
// Strip space and newline characters from string.
func stripSpaceChars(s string) string {
ss := ""