[Zope] String -> Hex -> String?

Jules zope@jules.com
Thu, 3 Feb 2000 13:13:31 -0500


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