Partial string comparisons
This ought to be mindlessly simple: can I test for a string within another? Example: Finding "<ul>" case insensitive within dtml-myvar? Usage: On a news site, users sometimes put lists in the stories, and I need to sense them in order to cleanly break out of them when summary pages truncate the story thus: <h1>Wow New Product!</h1> <p>Our new product is great, it has:</p> <ul> <li>A titanium case</li> <li>Rugged carry-straps</li> <li>Elasticated ... [More] << code needed here to close that <ul> neatly >> ---------------------- Andy Gates, Learning and Research Technology Andy.Gates@bristol.ac.uk - ICQ#74362415 http://www.ilrt.bristol.ac.uk
On Wed, Jun 13, 2001 at 02:39:52PM +0100, Andy Gates wrote:
This ought to be mindlessly simple: can I test for a string within another?
Refer to the DTML Users Guide, Table 4. As an example, stick this in a method: <dtml-call "REQUEST.set('mystring','This is a test')"> <dtml-var "_.string.find(mystring,'T')"><br> <dtml-var "_.string.find(mystring,'q')"> -- Mike Renfro / R&D Engineer, Center for Manufacturing Research, 931 372-3601 / Tennessee Technological University -- renfro@tntech.edu
participants (2)
-
Andy Gates -
Mike Renfro