You can use ^:_1 to get the inverse of a verb. So for example:
hex^:_1 'ff'
255
On 2 Nov 2011, at 06:37, Andrew Pennebaker wrote:
> Thanks Alan!
>
> hex =: '0123456789abcdef' {~ 16 16 #: ]
> dec =: '0123456789' {~ 10 10 #: ]
>
> How would one parse a hex string back to an integer?
>
> Cheers,
>
> Andrew Pennebaker
> www.yellosoft.us
>
> On Wed, Nov 2, 2011 at 12:53 AM, Alan Stebbens <[email protected]> wrote:
>
>> On Nov 1, 2011, at 8:33 PM, Andrew Pennebaker wrote:
>>
>>> All: Even more specifically, I'd like to format n as a two-digit,
>>> zero-padded, hexadecimal number.
>>
>> d2h =: '0123456789abcdef' {~ 16 16 #: ]
>>
>> d2h
>> '0123456789abcdef' {~ 16 16 #: [
>>
>> ;/d2h i.20
>> ┌──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┐
>> │00│01│02│03│04│05│06│07│08│09│0a│0b│0c│0d│0e│0f│10│11│12│13│
>> └──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┘
>>
>> ----------------------------------------------------------------------
>> For information about J forums see http://www.jsoftware.com/forums.htm
>>
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm