From 43a0e3cb7ca2e63f9a72f64924fb4af13d3a32ba Mon Sep 17 00:00:00 2001 From: siddontang Date: Sat, 13 Sep 2014 17:17:12 +0800 Subject: [PATCH] update --- num/str.go | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/num/str.go b/num/str.go index de0baff..9a56394 100644 --- a/num/str.go +++ b/num/str.go @@ -115,3 +115,43 @@ func Uint32ToString(v uint32) string { func Uint64ToString(v uint64) string { return strconv.FormatUint(uint64(v), 10) } + +func IntToSlice(v int) []byte { + return strconv.AppendInt(nil, int64(v), 10) +} + +func Int8ToSlice(v int8) []byte { + return strconv.AppendInt(nil, int64(v), 10) +} + +func Int16Slice(v int16) []byte { + return strconv.AppendInt(nil, int64(v), 10) +} + +func Int32ToSlice(v int32) []byte { + return strconv.AppendInt(nil, int64(v), 10) +} + +func Int64ToSlice(v int64) []byte { + return strconv.AppendInt(nil, int64(v), 10) +} + +func UintToSlice(v uint) []byte { + return strconv.AppendUint(nil, uint64(v), 10) +} + +func Uint8ToSlice(v uint8) []byte { + return strconv.AppendUint(nil, uint64(v), 10) +} + +func Uint16ToSlice(v uint16) []byte { + return strconv.AppendUint(nil, uint64(v), 10) +} + +func Uint32ToSlice(v uint32) []byte { + return strconv.AppendUint(nil, uint64(v), 10) +} + +func Uint64ToSlice(v uint64) []byte { + return strconv.AppendUint(nil, uint64(v), 10) +}