1. 程式人生 > >freemarker中的substring取子串

freemarker中的substring取子串

智能 幽默 pla 索引 教程 mark ring 老師 detail

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


再分享一下我老師大神的人工智能教程吧。零基礎!通俗易懂!風趣幽默!還帶黃段子!希望你也加入到我們人工智能的隊伍中來!https://blog.csdn.net/jiangjunshow

freemarker中的substring取子串