Formatting of numeric content plugin values
Posted: 2021-06-11, 10:39 UTC
Hello there,
Similar to [plugin.field:1-3] for getting substrings from content plugins, it would be great to have some formatting options for *numeric* values.
For example:
[plugin.field:d] for decimal (standard)
[plugin.field:x] for hex
[plugin.field:b] for binary
And even better:
[plugin.field:d3] for decimal with separator after each 3rd digit --> "2.220.211"
[plugin.field:x2] for hex with separator after each 2nd digit --> "01 AB 8F"
[plugin.field:b4] for binary with separator after each 4th digit --> "0021 0001"
And even better (and more general):
[plugin.field:fn"s"] with
f=format(d/x/X/b/o) : decimal, hex lower case, hex upper case, binary, octal
n=group length for the separator
s=the separator
This way,
["[0x"plugin.field:X2"_""]"] would result in "[0x01_02_03_04]" for the decimal value 16909060.
Of course, left padding, explicit signs, endianess, etc. could also be considered ...
What is your opinion?
BR
funkymonk
Similar to [plugin.field:1-3] for getting substrings from content plugins, it would be great to have some formatting options for *numeric* values.
For example:
[plugin.field:d] for decimal (standard)
[plugin.field:x] for hex
[plugin.field:b] for binary
And even better:
[plugin.field:d3] for decimal with separator after each 3rd digit --> "2.220.211"
[plugin.field:x2] for hex with separator after each 2nd digit --> "01 AB 8F"
[plugin.field:b4] for binary with separator after each 4th digit --> "0021 0001"
And even better (and more general):
[plugin.field:fn"s"] with
f=format(d/x/X/b/o) : decimal, hex lower case, hex upper case, binary, octal
n=group length for the separator
s=the separator
This way,
["[0x"plugin.field:X2"_""]"] would result in "[0x01_02_03_04]" for the decimal value 16909060.
Of course, left padding, explicit signs, endianess, etc. could also be considered ...
What is your opinion?
BR
funkymonk