Skip to content

lai323/bcd8421

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

BCD 8421 codec

BCD 8421 编解码

输入输出为数字字符串,没有数字大小限制

example

package main

import (
	"fmt"

	"github.com/lai323/bcd8421"
)

func main() {

	bytes, _ := bcd8421.EncodeFromStr("18749009700", 10)
	fmt.Println(fmt.Sprintf("%#x", bytes)) // output: 0x00000000018749009700

	s, _ := bcd8421.DecodeToStr(bytes, true)
	fmt.Println(s) // output: "18749009700"

}

About

BCD(Binary-Coded Decimal) 8421 codec

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages