String -> Hex -> String?
Hi. How can I increase a string-value "000001.abc001" by 1 in DTML when only the last 3 chars are the hex-value? Oliver .. Oliver Wrede .. owrede@khm.de .. Academy of Media Arts, Cologne .. Peter-Welter-Platz 2 . 50676 Koeln, Germany .. http://www.khm.de .. ICQ# 6580315 .. PGP 6.0 Fingerprint: .. 922C FFA2 9A07 5B8E CB2A 10A2 C370 6A62 2232 196C
On Thu, Feb 03, 2000 at 12:28:38PM +0100, Oliver Wrede wrote: |How can I increase a string-value "000001.abc001" by 1 in DTML when only the |last 3 chars are the hex-value? Here's an example for you: <dtml-call expr="REQUEST.set('tempvalue','000001.abc001')"> <dtml-var expr="_.hex(_.string.atoi(REQUEST.tempvalue[-3:],16)+1)"> Have a read of the Python docs on string.atoi and 'slices' (the [-3:] bit) in a string context. They're your best friends in this case. Cheers, Jules
participants (2)
-
Jules -
Oliver Wrede