예를 들면
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 통계를 어떻게 사용합니까?
감사!
다음은 계산을 수행하고 결과로 JMP 목록을 생성하는 JSL의 일부입니다.
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