freemarker中的split字符串分割

时间:2023-12-14 14:29:50

freemarker中的split字符串分割

1、简易说明

split分割:用来根据另外一个字符串的出现将原字符串分割成字符串序列

2、举例说明

<#--freemarker中的split字符串分割-->
     <#list "张三三,李思思,,王强,柳树,诸葛正我"?split(",") as name>
         "${name}"
     </#list>

     <#list "AhuAjiuAjkdsfAoionAjiuiAnujkkdfAkoijAmcjdhfjdfaAdhnfjdhfA"?split("A") as num>
         "${num}"
     </#list>

3、示例结果

<span style="white-space:pre">	</span> "张三三"
         "李思思"
         ""
         "王强"
         "柳树"
         "诸葛正我"

         ""
         "hu"
         "jiu"
         "jkdsf"
         "oion"
         "jiui"
         "nujkkdf"
         "koij"
         "mcjdhfjdfa"
         "dhnfjdhf"
         ""