Debian Codegraph @

tests/2138.gvpr

raw
1 BEGIN{
2 int i, j, l, cnt;
3 string POS, st, tst, tok[int];
4
5 void tstStuff(string inStr){
6
7 print ("// tok array count: ",cnt);
8 for (i=0;i<cnt;i++){
9 print("// tok[",i,"] >>",tok[i],"<< should NOT include trailing spaces or junk chars");
10 st=tok[i];
11 //st=sub(tok[i],"[ ]"); // remove tabs and spaces !!
12 l=length(st);
13 print("// length (st) : ",l);
14 j=index(st," ");
15 print("// index of space (st) : ", j, " << must NOT be less than -1");
16 st=sub(st,"[ ]");
17 print ("// st >>",st,"<<");
18 l=length(st);
19 print("// length (st) : ",l);
20 print("//");
21 }
22 }
23
24 tst=" abc def ghijk 3456789 012 ";
25 print("\n*****", tst, "******");
26 print("********* space delimiter *****************");
27 print("********* split results *****************");
28 cnt=split(tst, tok );
29 tstStuff();
30 print("\n********* tokens results ***************");
31 cnt=tokens(tst, tok );
32 tstStuff();
33
34 tst="^abc^def^^^ghijk^3456789^012^^^";
35 print("\n*****", tst, "******");
36 print("********* ^ delimiter *****************");
37 print("********* split results *****************");
38 cnt=split(tst, tok,"^" );
39 tstStuff();
40 print("\n********* tokens results ***************");
41 cnt=tokens(tst, tok, "^" );
42 tstStuff();
43 }