[Zope] string tokenizer, sql results

Dieter Maurer dieter@handshake.de
Tue, 9 Apr 2002 21:58:17 +0200


alexb@runbox.com writes:
 > Is it possible to have a String Tokenizer in Zope? I have an input field where the user is supposed to enter multiple keywords. How can I extract the keywords from the field, using space or comma as the delimeter? Can I do it from Zope or do I need to invoke a separate script?
If tokens are separated by whitespace (only and not commas), you
can use the ":tokens" suffix to request variables (described e.g. in

  <http://www.dieter.handshake.de/pyprojects/zope/book/chap3.html>

).

If you need "," as well as separator, you must tokenize yourself.
If "," alone is used as separator, the string method "split" is adequate maybe
in connection with "strip" (to remove whitespace at the ends).

Dieter