Boost logo

Boost Users :

Subject: Re: [Boost-users] Boost Spirit Karma - convert character to hex representation
From: Hartmut Kaiser (hartmut.kaiser_at_[hidden])
Date: 2015-04-19 09:23:27


> There is karma::hex formatter and I need somehow to add zero padding to
> get “0a” instead of just “a”. in addition it would be lovely to have some
> king of control over hex letter case. It sounds like a policies for real
> or Boolean formatters but I didn’t find one for hex. Is it possible to
> achieve the above without policy?

Padding can be achieved by using the right_align[] directive: http://www.boost.org/doc/libs/1_58_0/libs/spirit/doc/html/spirit/karma/reference/directive/alignment.html.

You can control the hex-letter case using the upper[] and lower[] directives: http://www.boost.org/doc/libs/1_58_0/libs/spirit/doc/html/spirit/karma/reference/directive/upperlower.html.

HTH
Regards Hartmut
---------------
http://boost-spirit.com
http://stellar.cct.lsu.edu


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net