v1.16.9
ADDED: * netx.IsPub * encodingx/hexx Rest are mostly small corrections and docs
This commit is contained in:
@@ -0,0 +1,67 @@
|
||||
package hexx
|
||||
|
||||
/*
|
||||
HexStrWithPrefix sets whether a prefix ("0x" by default, see [HexStrWithPrefixStr])
|
||||
*/
|
||||
func HexStrWithPrefix(pfx bool) (f hexStrFmtrOpt) {
|
||||
|
||||
f = func(h *hexStrFmtr) {
|
||||
if h.pfxStr == "" {
|
||||
h.pfxStr = "0x"
|
||||
}
|
||||
h.pfx = pfx
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
/*
|
||||
HexStrWithPrefixStr sets the prefix used if a prefix is to be included (see [HexStrWithPrefix]).
|
||||
|
||||
The default is "0x".
|
||||
*/
|
||||
func HexStrWithPrefixStr(pfx string) (f hexStrFmtrOpt) { return func(h *hexStrFmtr) { h.pfxStr = pfx } }
|
||||
|
||||
/*
|
||||
HexStrWithLower uses lowercase or uppercase hex character representation. The default is lowercase.
|
||||
|
||||
To use uppercase, specify this option with lower == false.
|
||||
*/
|
||||
func HexStrWithLower(lower bool) (f hexStrFmtrOpt) { return func(h *hexStrFmtr) { h.lower = lower } }
|
||||
|
||||
/*
|
||||
HexStrWithLeftPad specifies if left zero-padding should be used.
|
||||
|
||||
The default is true.
|
||||
*/
|
||||
func HexStrWithLeftPad(leftPad bool) (f hexStrFmtrOpt) {
|
||||
return func(h *hexStrFmtr) { h.noLeftPad = !leftPad }
|
||||
}
|
||||
|
||||
/*
|
||||
HexStrWithSegLeftPad specifies if left zero-padding should be used for each segment (see [HexStrWithSplit]).
|
||||
|
||||
The default is true.
|
||||
*/
|
||||
func HexStrWithSegLeftPad(segLeftPad bool) (f hexStrFmtrOpt) {
|
||||
return func(h *hexStrFmtr) { h.noSegmentLeftPad = !segLeftPad }
|
||||
}
|
||||
|
||||
/*
|
||||
HexStrWithSplit will split the hex string into "chunks" of numBytes bytes.
|
||||
|
||||
For example:
|
||||
numBytes == 0:
|
||||
0x0123456789abcdef
|
||||
|
||||
numBytes == 1:
|
||||
0x01 0x23 0x45 0x67 0x89 0xab 0xcd 0xef
|
||||
|
||||
numBytes == 2:
|
||||
0x0123 0x4567 0x89ab 0xcdef
|
||||
*/
|
||||
func HexStrWithSplit(numBytes uint) (f hexStrFmtrOpt) {
|
||||
return func(h *hexStrFmtr) { h.segmentBytes = numBytes }
|
||||
}
|
||||
|
||||
// TODO
|
||||
Reference in New Issue
Block a user