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

$string.setCharAt
This function replaces the character at the specified index with a new character. The result is returned in a new string.
Syntax
$string.setCharAt(<inStr>, <index>, <char>)
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.
char
Template examples
Example 89
Template
#set($str='Hello World!')
#set($newStr=$string.setCharAt($str, 5, '-'))
Original string: $str
New string: $newStr
Output
Original string: Hello World!
New string: Hello-World!
 
 
OpenText StreamServe 5.6.2 Updated: 2018-01-26