Add tasks for all the new languages
This commit is contained in:
parent
9dc3c2bb62
commit
bba7bfd280
13208 changed files with 134745 additions and 0 deletions
35
Task/String-comparison/Lasso/string-comparison.lasso
Normal file
35
Task/String-comparison/Lasso/string-comparison.lasso
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
// Comparing two strings for exact equality
|
||||
"'this' == 'this': " + ('this' == 'this') // true
|
||||
"'this' == 'This': " + ('this' == 'This') // true, as it's case insensitive
|
||||
|
||||
// Comparing two strings for inequality (i.e., the inverse of exact equality)
|
||||
"'this' != 'this': " + ('this' != 'this')// false
|
||||
"'this' != 'that': " + ('this' != 'that') // true
|
||||
|
||||
// Comparing two strings to see if one is lexically ordered before than the other
|
||||
"'alpha' < 'beta': " + ('alpha' < 'beta') // true
|
||||
"'beta' < 'alpha': " + ('beta' < 'alpha') // false
|
||||
|
||||
// Comparing two strings to see if one is lexically ordered after than the other
|
||||
"'alpha' > 'beta': " + ('alpha' > 'beta') // false
|
||||
"'beta' > 'alpha': " + ('beta' > 'alpha') // true
|
||||
|
||||
// How to achieve both case sensitive comparisons and case insensitive comparisons within the language
|
||||
"case sensitive - 'this'->equals('This',-case=true): " + ('this'->equals('This',-case=true)) // false
|
||||
"case insensitive - 'this'->equals('This',-case=true): " + ('this'->equals('This')) // true
|
||||
|
||||
// How the language handles comparison of numeric strings if these are not treated lexically
|
||||
"'01234' == '01234': "+ ('01234' == '01234') // true
|
||||
"'01234' == '0123': " + ('01234' == '0123') // false
|
||||
"'01234' > '0123': " + ('01234' > '0123') // true
|
||||
"'01234' < '0123': " + ('01234' < '0123') //false
|
||||
|
||||
// Additional string comparisons
|
||||
"'The quick brown fox jumps over the rhino' >> 'fox' (contains): " +
|
||||
('The quick brown fox jumps over the rhino' >> 'fox') // true
|
||||
"'The quick brown fox jumps over the rhino' >> 'cat' (contains): " +
|
||||
('The quick brown fox jumps over the rhino' >> 'cat') // false
|
||||
"'The quick brown fox jumps over the rhino'->beginswith('rhino'): " +
|
||||
('The quick brown fox jumps over the rhino'->beginswith('rhino')) // false
|
||||
"'The quick brown fox jumps over the rhino'->endswith('rhino'): " +
|
||||
('The quick brown fox jumps over the rhino'->endswith('rhino')) // true
|
||||
Loading…
Add table
Add a link
Reference in a new issue