BEGIN Integer i; Text FN; integer procedure fieldcount(T,C); text T; character C; begin integer N; while T.more do begin n:= n+1; while T.more and then t.getchar <> C do; end; fieldcount := N; end; FN :- "/aaa/bbb/ccc/"; outint(fieldCount("",'/'),5); outimage; outint(fieldCount("a",'/'),5); outimage; outint(fieldCount(FN,'/'),5); outimage; outint(fieldCount(FN,'/'),5); outimage; outint(fieldCount(FN.sub(2,FN.length-1),'/'),5); outimage; FN.setpos(2); outint(fieldCount(FN,'/'),5); outimage; END; % xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx % 0.933 sec cpu Simpp v1.3, tokenizer v2.7 % xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx