转换格式化器
Version 25.1.9222
Version 25.1.9222
- concat([newString])
- insert(integer_index, string)
- regexreplace(pattern, newvalue[, startindex])
- remove(integer_index[, integer_count])
- replace(oldvalue, newvalue[, ishex])
- rsplit(delimiter, integer_index)
- split(delimiter, indextoreturn, trimresult, removeempty)
- striphtml()
- substring(index[, length])
- toalpha()
- toalphanum()
- truncate(integer_count)
转换格式化器
concat([newString])
将参数拼接到之前的文本之后。
- newString: 将拼接的字符串。
insert(integer_index, string)
在指定的索引处插入指定的字符串。
- index:原值中插入新字符串的位置从 0 开始的索引。
- string:要插入到原始值中的字符串。
regexreplace(pattern, newvalue[, startindex])
在输入字符串中搜索 pattern 指定的正则表达式模式,并用 newvalue 替换每个出现的位置。
- pattern:要替换的正则表达式模式。
- newvalue:要用作替换的值。
- startindex:如果提供,则搜索从字符串中的此位置开始(换句话说,格式化程序会忽略在 startindex 之前出现的 pattern 实例)。
- empty_match_all:如果替换正则表达式模式将返回空值,则返回原始字符串(默认值为
true
)。
示例
<arc:set attr="myString" value="The cost of the item is $12.98." />
<arc:set attr="decimalPattern" value="\[0-9\]+\.?\[0-9\]*" />
<arc:set attr="updatedListing" value="[myString | regexreplace([decimalPattern],'10.99')]" />
<!-- updatedListing has the value: The cost of the item is $10.99 -->
remove(integer_index[, integer_count])
从属性值中删除字符; 从第一个参数指定的从 0 开始的索引开始。
- index:开始删除字符的位置。
- count:可选值,要删除的字符数。如果没有提供,将删除从指定索引开始的所有字符。
replace(oldvalue, newvalue[, ishex])
在输入字符串中搜索每次出现的 oldvalue,将其删除,然后用 newvalue 替换。
- oldvalue:要替换的原始值。
- newvalue:要用作替换的值。
- ishex:指示 oldvalue 参数是否是要替换的字符的十六进制表示形式(默认值为
false
)。 - empty_match_all:如果替换 oldvalue 会返回空字符串,则返回原始值(默认值为
true
)。
示例
<arc:set attr="myString" value="I hope you have a wonderful day." />
<arc:set attr="honestString" value="[myString | replace('you', 'I')]" />
<!-- honestString holds the value: I hope I have a wonderful day. -->
<arc:set attr="anotherString" value="[myString | replace(20, '-', true)]" />
<!-- anotherString holds the value: I-hope-you-have-a-wonderful-day. -->
rsplit(delimiter, integer_index)
将属性值表示的字符串拆分成以第一个参数分隔的标记,并在第二个参数指定的索引处返回标记;从右开始计数。
- delimiter:用作分隔符的字符串,用于将字符串拆分为标记。
- index:请求的标记的索引,第一个标记在索引 1 处。
split(delimiter, indextoreturn, trimresult, removeempty)
将每次出现 delimiter 时的输入字符串拆分为一组子字符串,然后返回给定 index 处的字符串。
- indextoreturn:如果提供,则对子字符串集进行索引以返回其中一个子字符串(例如,传递“1”作为 indextoreturn 将返回拆分产生的第一个子字符串)。
- trimresult:默认情况下,返回的值会修剪前导和尾随空格。将其设置为“false”可返回子字符串中的所有字符。
- removeempty:默认情况下,格式化程序不会删除空元素。将其设置为“true”可删除它们。
示例
<arc:set attr="myName" value="Walter White" />
<arc:set attr="firstName" value="[myName | split(' ',1)]" />
<!-- firstName contains the value: Walter -->
striphtml()
返回去掉所有 HTML 标记的字符串。
substring(index[, length])
返回输入字符串值的子字符串,从 index 值开始,以 length 个字符结束。 如果未提供_length_,则子字符串将在原始字符串的末尾结束。
示例
<!-- parse out the characters before the first comma, combining substring() with find() -->
<arc:set attr="myString" value="Luke, I am your father". />
<arc:set attr="commaPosition" value="[myString | find(',')]" />
<arc:set attr="introClause" value="[myString | substring(0, [commaPosition])]" />
<!-- introClause has the value: Luke -->
toalpha()
只返回字符串中的字母。
toalphanum()
只返回字符串中的字母数字字符。
truncate(integer_count)
将属性值截断为参数指定的字符数。
- count:结果字符串中的字符数。