go-hexadeca/runes/encodebyte.go

27 lines
811 B
Go
Raw Permalink Normal View History

2023-10-27 20:25:50 +00:00
package hexadecarunes
2023-10-27 00:21:23 +00:00
2023-10-27 18:58:14 +00:00
import (
2024-07-25 11:33:45 +00:00
"github.com/reiver/go-hexadeca/symbols/rune"
2023-10-27 18:58:14 +00:00
)
2023-10-27 00:21:23 +00:00
// EncodeByte encodes the value of a byte into hexadecimal.
func EncodeByte(value byte, symbolFunc func(byte)rune) (mostSignificant rune, leastSignificant rune) {
2023-10-28 20:25:44 +00:00
mostSignificant = symbolFunc( (0x0f & (value >> 4)) )
leastSignificant = symbolFunc( (0x0f & (value )) )
2023-10-27 00:21:23 +00:00
return
}
func EncodeByteUsingLowerCaseSymbols(value byte) (mostSignificant rune, leastSignificant rune) {
2023-10-27 18:58:14 +00:00
return EncodeByte(value, runesymbols.LowerCase)
2023-10-27 00:21:23 +00:00
}
func EncodeByteUsingPersianSymbols(value byte) (mostSignificant rune, leastSignificant rune) {
2023-10-27 18:58:14 +00:00
return EncodeByte(value, runesymbols.Persian)
2023-10-27 00:21:23 +00:00
}
func EncodeByteUsingUpperCaseSymbols(value byte) (mostSignificant rune, leastSignificant rune) {
2023-10-27 18:58:14 +00:00
return EncodeByte(value, runesymbols.UpperCase)
2023-10-27 00:21:23 +00:00
}