Per esempio,
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
Come cna usa le statistiche JSL?
Grazie!
Ecco un pezzo di JSL che esegue i calcoli e crea un elenco JMP con i risultati
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);
Ritorna
resultList = {3, 2, 7, 10};Cerca una stringa per tutte le occorrenze di un pattern mostra una soluzione generica utilizzando il pattern matcher. Più difficile da capire ma dovrebbe avere un comportamento O (N) su stringhe grandi.
txt="1ab34cab4abba";
t0="ab";
num=3