Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
28
Task/String-matching/Run-BASIC/string-matching.basic
Normal file
28
Task/String-matching/Run-BASIC/string-matching.basic
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
s1$ = "abc def ghi klmnop"
|
||||
s2$ = "abc" ' begins with
|
||||
s3$ = "ef" ' is in the string
|
||||
s4$ = "nop" ' ends with
|
||||
|
||||
sn2$ = "abcx" ' not begins with
|
||||
sn3$ = "efx" ' not in the string
|
||||
sn4$ = "nopx" ' not ends with
|
||||
|
||||
if left$(s1$,len(s2$)) <> s2$ then a$ = "Not "
|
||||
print "String:";s1$;" does ";a$;"begin with:";s2$
|
||||
|
||||
if instr(s1$,s3$) = 0 then a$ = "Not "
|
||||
print "String:";s1$;" does ";a$;"contain:";s3$
|
||||
|
||||
if mid$(s1$,len(s1$) + 1 - len(s4$),len(s4$)) <> s4$ then a$ = "Not "
|
||||
print "String:";s1$;" does ";a$;"end with:";s4$
|
||||
|
||||
' ----------- not -----------------------------
|
||||
print
|
||||
if left$(s1$,len(sn2$)) <> sn2$ then a$ = "Not "
|
||||
print "String:";s1$;" does ";a$;"begin with:";sn2$
|
||||
|
||||
if instr(s1$,sn3$) = 0 then a$ = "Not "
|
||||
print "String:";s1$;" does ";a$;"contain:";sn3$
|
||||
|
||||
if mid$(s1$,len(s1$) + 1 - len(sn4$),len(sn4$)) <> sn4$ then a$ = "Not "
|
||||
print "String:";s1$;" does ";a$;"end with:";sn4$
|
||||
Loading…
Add table
Add a link
Reference in a new issue