How to convert hexadecimal to decimal in a substitution statement?

Posted by stefanzweig on Stack Overflow See other posts from Stack Overflow or by stefanzweig
Published on 2010-06-07T10:01:36Z Indexed on 2010/06/07 11:12 UTC
Read the original article Hit count: 160

Filed under:

I have a line like this:

pad (2) = 0x0041

I wanna change the hex into decimal and the expected result is

pad (2) = 65

I just tried :%s/\(.*\) = \(.*\)/\1 = \=printf("%d", submatch(2)), but it failed.

Would you help to solve this? Thank you very much.

© Stack Overflow or respective owner

Related posts about vim