Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
26
Task/String-comparison/BASIC256/string-comparison.basic
Normal file
26
Task/String-comparison/BASIC256/string-comparison.basic
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
function StringCompare(s1, s2, ignoreCase)
|
||||
if ignoreCase then
|
||||
s = lower(s1)
|
||||
t = lower(s2)
|
||||
else
|
||||
s = s1
|
||||
t = s2
|
||||
end if
|
||||
if s < t then return " comes before "
|
||||
if s = t then return " is equal to "
|
||||
return " comes after "
|
||||
end function
|
||||
|
||||
s1 = "Dog" : s2 = "Dog"
|
||||
print s1; StringCompare(s1, s2, False); s2
|
||||
s2 = "Cat"
|
||||
print s1; StringCompare(s1, s2, False); s2
|
||||
s2 = "Rat"
|
||||
print s1; StringCompare(s1, s2, False); s2
|
||||
s2 = "dog"
|
||||
print s1; StringCompare(s1, s2, False); s2
|
||||
print s1; StringCompare(s1, s2, True); s2; " if case is ignored"
|
||||
s1 = "Dog" : s2 = "Pig"
|
||||
s3 = StringCompare(s1, s2, False)
|
||||
if s3 <> " is equal to " then print s1; " is not equal to "; s2
|
||||
end
|
||||
Loading…
Add table
Add a link
Reference in a new issue