* JustSome person <[EMAIL PROTECTED]> [2002-12-07 20:45]:
> Hey all,
> 
> I have a string, since it is dynamic from a database I
> never know what it can contain....BUT if the last
> character of that string is a "Z", then it returns
> false...unfortunetly, I am not using the latest
> version of template toolkit. I have ".search()"....but
> not ".match()" methods....and I replace()...
> 
> anyways,,,,how can I take a string..ala..
> 
> [% dynamicstring %]
> 
> and test to see if "dynamicstring"...has a Z as its
> last character??? keep in mind that Z can be IN the
> string, just not the last character.

The search vmeth is what you want, to find if a string contains a
pattern:

  [% dynamicstring = 'dragonballZ' %]
  [% IF dynamicstring.search('Z') %]
    dynamicstring has a 'Z'
  [% ELSE %]
    Sorry, no love
  [% END %

How old is your copy of TT?  According to CVS, the latest change to the
search vmeth was in June 2001, which was probably about 2.03 (-ish).

(darren)

-- 
The rebootings will continue until the configuration works.

_______________________________________________
templates mailing list
[EMAIL PROTECTED]
http://lists.ourshack.com/mailman/listinfo/templates

Reply via email to