Netsuite FreeMarker 如何拆分字符串和使用索引

Netsuite FreeMarker How to split String and Use the Index

我是 NetSuite Technical 的新手,我正在自定义发票,我们的客户在同一字段中同时使用阿拉伯语和英语数据,因此如果我使用 NotoSansArabic,它不会显示英文字母,如果我删除了字体;阿拉伯字母将无法正确显示。 所以,我想拆分字段中的字符串以显示 Invoice/report.

中的每组语言

我想拆分出现字符“-”的字段,为第一个Splitted String NotoSanArabic设置字体,让第二个保持正常

我想做这样的事情

<td>
   <#assign CustName={ record.entity} ? split( "-")>
   </#assign>
   CustName[0]
   <!--Can I read the Index of the First Splitted String-->
   CustName[1]
</td>

我会将索引 0 的字体设置为阿拉伯语并保持索引 1 正常

像这样:

<#assign CustName=record.entity?split("-")>
${CustName[0]}
${CustName[1]}

但是,只有在名称中始终恰好有一个 - 时,这才会按预期工作。如果不是这种情况(特别是如果其中可以有 0 -),那么改为这样做:

${record.entity?keep_before('-')}
${record.entity?keep_after('-')}