Template Engine language reference > Template Engine utilities > String functions > $string.endsWith

$string.endsWith
This function tests if a string ends with the specified suffix. Returns true if the input string ends with the specified suffix, if not it returns false.
Syntax
$string.endsWith(<inStr>, <suffix>)
inStr
suffix
Template examples
Example 96
Template
#set($str='logo.png')
#set($check=$string.endsWith($str, 'png'))
#if($check)
$str
#else
No match!
#end
Output
logo.png
 
Example 97
Template
#set($str='logo.jpg')
#set($check=$string.endsWith($str, 'png'))
#if($check)
$str
#else
No match!
#end
Output
No match!
 
OpenText StreamServe 5.6.2 Updated: 2018-01-26