Debian Codegraph @

testsuite/systemtap.string/tokenize.stp

raw
1 function tokprint(str, delim)
2 {
3 println("-")
4
5 tok = tokenize(str, delim)
6 while (tok != "") {
7 println(tok)
8 tok = tokenize("", delim)
9 }
10 }
11
12 probe begin
13 {
14 teststr1 = "one|two|three|four|five|six|seven|eight|nine|ten"
15 teststr2 = "a,b,c,d,e,f,g"
16 teststr3 = "1,,2,3, ,4"
17 teststr4 = ""
18 teststr5 = "this is a string with no delimiters"
19 teststr6 = "this is a string, which has two delimiters"
20
21 tokprint(teststr1, "|")
22 tokprint(teststr1, ",")
23 tokprint(teststr2, ",")
24 tokprint(teststr3, ",")
25 tokprint(teststr4, ",")
26 tokprint(teststr5, ",")
27 tokprint(teststr6, ", ")
28
29 exit()
30 }