使用此插件
apl
函数使用以下参数:
lv
(必需,字符串):包含要向其添加新值的已分隔列表的变量vta
(必需,字符串):要添加到lv
参数值的以逗号分隔的新值列表。d1
(可选,字符串):用于分隔已包含在lv
参数中的各个值的分隔符。如果未设置,则将默认使用逗号 (,
)。d2
(可选,字符串):输出分隔符。如果未设置,则默认值与d1
的值相同。cc
(可选,布尔值):指示是否使用区分大小写检查的标志。如果为true
,则重复检查区分大小写。如果为false
或未设置,则重复检查不区分大小写。默认为false
。
apl
函数会返回 lv
参数的值以及 vta
参数中的任何非重复值。
示例
// Set the events variable to "event22,event24,event23".
s.events = "event22,event24";
s.events = apl(s.events,"event23");
// The events variable remains unchanged because the apl function does not add duplicate values
s.events = "event22,event23";
s.events = apl(s.events,"event23");
// Set the events variable to "event23" if the events variable is blank
s.events = "";
s.events = apl(s.events,"event23");
// Append a value to eVar5. The value of prop4 remains unchanged.
// The value of eVar5 is "hello|people|today".
s.prop4 = "hello|people";
s.eVar5 = apl(s.prop4, "today", "|");
// Sets prop4 to "hello|people,today". Be mindful of correct delimiters!
s.prop4 = "hello|people";
s.prop4 = apl(s.prop4, "today");
// Sets the events variable to "event22,event23,EVentT23". Be mindful of capitalization when using the cc argument!
s.events = "event22,event23";
s.events = apl(s.events,"EVenT23", ",", ",", true);
// Sets the events variable to "event22,event23,event24,event25".
s.events = "event22,event23";
s.events = apl(s.events, "event23,event24,event25");
// Sets linkTrackVars to "events,eVar1,campaign".
// The last three arguments at the end of this apl call are not necessary because they match the default argument values.
s.linkTrackVars = "events,eVar1";
s.linkTrackVars = apl(s.linkTrackVars, "campaign", ",", ",", false);
// This apl call does not do anything because the code does not assign the returned value to a variable.
s.events = "event22,event24";
apl(s.events, "event23");
// Sets the list2 variable to "apple-APPLE-Apple".
// Since the two delimiter arguments are different, the value passed in is delimited by "|", then joined together by "-".
s.list2 = "apple|APPLE";
s.list2 = apl(s.list2, "Apple", "|", "-", true);
// Sets the list3 variable to "value1,value1,value1" (unchanged).
// Only new values are deduplicated. Existing duplicate values remain.
s.list3 = "value1,value1,value1";
s.list3 = apl(s.list3,"value1");
版本历史记录
4.0(2021 年 3 月 19 日)
- 以上下文数据形式添加了版本号。
3.2(2019 年 9 月 25 日)
- 修复了使用旧版插件的
apl
调用存在的兼容性问题 - 删除了控制台警告以减小大小
- 添加了
inList 2.1
3.1(2018 年 4 月 22 日)
- 如果未设置,则
d2
参数现在默认为d1
参数的值
3.0(2018 年 4 月 16 日)
- 对插件进行了彻底的再分析/重写
- 添加了高级错误检查
vta
参数现在一次可接受多个值- 添加了
d2
参数以设置返回值的格式 - 将
cc
参数更改为布尔值
2.5(2016 年 2 月 18 日)
- 现在使用
inList
函数进行比较处理
2.0(2016 年 1 月 26 日)
d
(分隔符)参数现在为可选参数(默认为逗号)u
(区分大小写标记)参数现在为可选参数(默认为不区分大小写)- 无论
u
(区分大小写标记)参数为何值,如果该值已存在于列表中,则插件都不会再向列表附加值