| |||||||||
|
| |||||||||
|
Writing Templates - String Function Tags
BeanMaker support a few strings function to help you perform simple string manipulation. The string parameters in the above functions can contain string constants, BeanMaker's tags or even other functions. Examples:
$lower('Java')$ => java
$upper('Hello World')$ => HELLO WORLD
$upper('$class$')$ => convert the representation of the $class$ tag to upper case
$substr('cylog',1,2)$ => "cy"
$substr('cylog',1,200)$ => "cylog" (returns all remaining characters)
$substr('cylog',3,2)$ => "lo" (returns 2 characters starting from the 3rd character)
$substr('cylog',3,0)$ => "" (empty string)
$substr('cylog',1,1)$ => "c" (first char)
$substr('cylog',2,1)$ => "y" (second char)
$substr('cylog',3,1)$ => "l" (third char)
$substr('cylog',4,1)$ => "o" (fourth char)
$substr('cylog',5,1)$ => "g" (fifth char)
$substr('cylog',6,1)$ => "" (no chars at position 6)
$rpad('cylog',8)$ => "cylog "
$lpad('cylog',8)$ => " cylog"
$zeropad(1,4)$ => "0001"
$zeropad(22,4)$ => "0022"
$zeropad(123,2)$ => "123" (number is longer than the requested number of chars)
$equals('$index$','0', 'zero','not zero')$ => "zero" when the $index$ tag is "0", "not zero" otherwise
$pos('x','banana')$ => "0"
$lastpos('x','banana')$ => "0"
$pos('a','banana')$ => "2"
$lastpos('a','banana')$ => "6"
$pos('ana','banana')$ => "2"
$lastpos('ana','banana')$ => "4"
To convert to lower caser the first letter of a property, do this:
$upper('$substr('$property$',1,1)$')$$substr('$property$',2,255)$
Explanation:
$substr('$property$',1,1)$ => the first letter or the property
$upper(' ')$ => uppercase of the first letter
$substr('$property$',2,255)$ => the rest of the property string
|
|||||||||
| Copyright ©2000-2006 CyLog Software www.cylog.org | |||||||||