例如,
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