Formatting of numeric content plugin values

Here you can propose new features, make suggestions etc.

Moderators: white, Hacker, petermad, Stefan2

Post Reply
User avatar
funkymonk
Senior Member
Senior Member
Posts: 410
Joined: 2013-12-04, 09:56 UTC

Formatting of numeric content plugin values

Post by *funkymonk »

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
User avatar
funkymonk
Senior Member
Senior Member
Posts: 410
Joined: 2013-12-04, 09:56 UTC

Re: Formatting of numeric content plugin values

Post by *funkymonk »

Hello there,

I wanted to bring up the suggestion again with some more information about why it could be an interesting feature:
  • As a developer, I am interested in some content fields that actually represent addresses, bitfields, etc. Thus, hex and binary are particularly interesting.
  • When dealing with graphics/photos, I am sometimes interested in the overall pixel count. Here, decimal is great but unnecessarily difficult to read for large values without separator.
Maybe others can support the idea ...?

BR
funkyMonk.
User avatar
funkymonk
Senior Member
Senior Member
Posts: 410
Joined: 2013-12-04, 09:56 UTC

Re: Formatting of numeric content plugin values

Post by *funkymonk »

09.03.22 Added: Content plugins: output numbers as hex, octal or binary. Syntax: [=plugin.field._format]. Example: field._x02' d=decimal, x=lowercase hex, X=uppercase hex, o=octal, b=binary, 0=keep leading zeroes, 2=2 digit groups, '=separator (32/64)

Thank you for adding this feature! Great!!!
Post Reply