Chris Beaumont wrote:
> Hi,
> I just realized I need to split a potentially pretty long textfield
> input from a web form into 2000 character chunks, for input into a
> database. I see a lot of string functions in DTML, but none that
> looks like it will do this..

Use a Python Script:

offset = 0

while offset + 2000 < len(yourstring):
        offset = offset + 2000


return list

then you can do:

<dtml-in yourexternalmethod>

...with the 2000 char chunks.

Well, hope this helps. I'm sure there's at least one off-by-one bug in
the above. It'd be a lot easier to do if regular expressions were
available in python scripts:

return re.findall('.{0,2000}',yourstring)

...but sadly we're not allowed to use regular expressions in pythno
scripts in case we break something :-((



Zope maillist  -  [EMAIL PROTECTED]
**   No cross posts or HTML encoding!  **
(Related lists - )

Reply via email to