Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
11
Task/String-comparison/Lingo/string-comparison-1.lingo
Normal file
11
Task/String-comparison/Lingo/string-comparison-1.lingo
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
put "abc"="ABC"
|
||||
-- 1
|
||||
|
||||
put "abc"<>"def"
|
||||
-- 1
|
||||
|
||||
put "abc"<"def"
|
||||
-- 1
|
||||
|
||||
put "abc">"def"
|
||||
-- 0
|
||||
10
Task/String-comparison/Lingo/string-comparison-2.lingo
Normal file
10
Task/String-comparison/Lingo/string-comparison-2.lingo
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
-- Returns -1 if str1 is less than str2
|
||||
-- Returns 1 if str1 is greater than str2
|
||||
-- Returns 0 if str1 and str2 are equal
|
||||
on strcmp (str1, str2)
|
||||
h1 = bytearray(str1).toHexString(1, str1.length)
|
||||
h2 = bytearray(str2).toHexString(1, str2.length)
|
||||
if h1<h2 then return -1
|
||||
else if h1>h2 then return 1
|
||||
return 0
|
||||
end
|
||||
Loading…
Add table
Add a link
Reference in a new issue