File: instrtest.kbs

package info (click to toggle)
basic256 0.9.6.69a-1
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 26,304 kB
  • sloc: cpp: 7,778; yacc: 926; lex: 575; sh: 21; makefile: 7
file content (31 lines) | stat: -rw-r--r-- 792 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# instrtest.kbs 2011-01-05 j.m.reneau
# for 0.9.6.56 and later
a$ = "Now is the time for all good men to  come to the Aid of Their party."
print "location of men = " + instr(a$,"men")
print "location of aid = " + instr(a$,"aid")
print "location of aid (ignore case) = " + instr(a$,"aid",1,true)
#
print "locations of all spaces"
l = instr(a$," ")
while l <> 0
   print l + " ";
   l = instr(a$," ",l+1)
end while
print
#
print "print words"
oldl = 1
l = instr(a$," ")
k = 0
while l <> 0
   k = k + 1
   print k + " '" + mid(a$,oldl, l-oldl) + "'"
   oldl = l + 1
   l = instr(a$," ",l+1)
end while
k = k + 1
print k + " '" + mid(a$,oldl, 99999) + "'"
#
print "location of regex [Aa]id = " + instrx(a$,"[Aa]id")
print "location of regex [Hh][Ee] starting at 50 = " + instrx(a$,"[Hh][Ee]",50)