string tokenizer, sql results
Hi all, 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? I've also noticed that when displaying search results, the "Previous Results" link is displayed at the top, and the "Next X results" is at the bottom. If I cut and paste the previous results link at the bottom it doesn't work. I experimented with it and noticed that it only works within or outside the <dtml-if sequence_start> tag. However, if I put it within the <dtml-if sequence_end> tag it does not appear, as it has the <dtml-if previous_results> statement. Does this mean I can't have a "previous results" and a "next results" options together, side by side? Thanks, Alex
use _string.split(string-to-split,delimiter) Cheers, Tom P [<alexb@runbox.com>] 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?
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
participants (3)
-
alexb@runbox.com -
Dieter Maurer -
Thomas B. Passin