mirror of
https://github.com/charlienet/go-mixed.git
synced 2025-07-17 16:12:42 +08:00
20 lines
301 B
Go
20 lines
301 B
Go
package encode
|
|
|
|
import "encoding/hex"
|
|
|
|
type BytesResult []byte
|
|
|
|
func FromString(s string) BytesResult {
|
|
return BytesResult([]byte(s))
|
|
}
|
|
|
|
func FromHexString(s string) BytesResult {
|
|
b, _ := hex.DecodeString(s)
|
|
return BytesResult(b)
|
|
}
|
|
|
|
func FromBytes(b []byte) BytesResult {
|
|
return BytesResult(b)
|
|
}
|
|
|