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

$string.getCharAt
This function returns the character at the specified index.
Syntax
$string.getCharAt(<inStr>, <index>)
inStr
index
The index defining the position in the input string. The index is zero based which means the first character in the input string has the index 0.
Template examples
Example 87
Template
#set($str='Hello World!')
Character is: $string.getCharAt($str, 6)
Output
Character is: W
 
Example 88
Template
#set($str='Hello World!')
#set($index=6)
#set($pos=$index+1)
Original string is: $str
Character at position $pos is: $string.getCharAt($str, $index)
Output
Original string is: Hello World!
Character at position 7 is: W
 
OpenText StreamServe 5.6.2 Updated: 2018-01-26