freemarker中的substring取子串
1、substring取子串介绍
(1)表达式?substring(from,to)
(2)当to为空时,默认的是字符串的长度
(3)from是第一个字符的開始索引。to最后一个字符之后的位置索引
2、举例说明
<#--freemarker中的substring取子串--> ${'EFGHIJKL'?substring(0)} ${'EFGHIJKL'?substring(1)} ${'EFGHIJKL'?
substring(2)} ${'EFGHIJKL'?substring(3)} ${'EFGHIJKL'?substring(4)} ${'EFGHIJKL'?substring(5)} ${'EFGHIJKL'?substring(6)} ${'EFGHIJKL'?substring(7)} ${'EFGHIJKL'?substring(8)} ${'EFGHIJKL'?substring(0,1)} ${'EFGHIJKL'?
substring(0,2)} ${'EFGHIJKL'?
substring(0,3)} ${'EFGHIJKL'?substring(0,4)} ${'EFGHIJKL'?substring(0,5)} ${'EFGHIJKL'?
substring(0,6)} ${'EFGHIJKL'?substring(0,7)} ${'EFGHIJKL'?substring(0,8)}
3、演示样例结果
EFGHIJKL FGHIJKL GHIJKL HIJKL IJKL JKL KL L E EF EFG EFGH EFGHI EFGHIJ EFGHIJK EFGHIJKL