https://github.com/lai323/bcd8421
BCD(Binary-Coded Decimal) 8421 codec
https://github.com/lai323/bcd8421
bcd binary-coded-decimal codec
Last synced: 5 months ago
JSON representation
BCD(Binary-Coded Decimal) 8421 codec
- Host: GitHub
- URL: https://github.com/lai323/bcd8421
- Owner: lai323
- Created: 2021-07-11T15:39:42.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2021-08-16T00:58:14.000Z (almost 5 years ago)
- Last Synced: 2023-07-27T22:18:24.025Z (almost 3 years ago)
- Topics: bcd, binary-coded-decimal, codec
- Language: Go
- Homepage:
- Size: 4.88 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
# BCD 8421 codec
[BCD](https://zh.wikipedia.org/zh-cn/%E4%BA%8C%E9%80%B2%E7%A2%BC%E5%8D%81%E9%80%B2%E6%95%B8) 8421 编解码
输入输出为数字字符串,没有数字大小限制
### example
```go
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"
}
```