例如,
txt="1ab34cab4abba";
t0="ab";
x=3;//"ab"appears three times in TXT——??X=N Rows(Loc(txt,t0));
m1=2;// The first occurrence of "ab" in TXT is 2
m2=7;// The second occurrence of "ab" in TXT is 7
m3=10;// The third occurrence of "ab" in TXT is 10
cna如何使用JSL统计信息?
谢谢!
这是一段JSL,您可以进行计算,并使用结果创建一个JMP列表
names default to here(1);
txt="1ab34cab4abba";
t0="ab";
resultList = {0};
target = txt;
while(contains(target,t0),
resultList[1] = resultList[1] + 1;
insert into(resultList,contains(target,t0));
target=substr(target,1,contains(target,t0)-1) || "~~" || substr(target,contains(target,t0)+2);
);
show(resultList);
它返回
resultList = {3, 2, 7, 10};在字符串中搜索所有出现的模式显示了使用模式匹配器的通用解决方案。 较难理解,但对大字符串应具有O(N)行为。
txt="1ab34cab4abba";
t0="ab";
num=3