RosettaCodeData/Task/String-comparison/MiniScript/string-comparison.mini

50 lines
1.3 KiB
Plaintext

string1 = input("Please enter a string.")
string2 = input("Please enter a second string.")
//Comparing two strings for exact equality
if string1 == string2 then
print "Strings are equal."
end if
//Comparing two strings for inequality
if string1 != string2 then
print "Strings are NOT equal."
end if
//Comparing two strings to see if one is lexically ordered before than the other
if string1 > string2 then
print string1 + " is lexically ordered AFTER " + string2
//Comparing two strings to see if one is lexically ordered after than the other
else if string1 < string2 then
print string1 + " is lexically ordered BEFORE " + string2
end if
//How to achieve case sensitive comparisons
//Comparing two strings for exact equality (case sensitive)
if string1 == string2 then
print "Strings are equal. (case sensitive)"
end if
//Comparing two strings for inequality (case sensitive)
if string1 != string2 then
print "Strings are NOT equal. (case sensitive)"
end if
//How to achieve case insensitive comparisons within the language
//Comparing two strings for exact equality (case insensitive)
if string1.lower == string2.lower then
print "Strings are equal. (case insensitive)"
end if
//Comparing two strings for inequality (case insensitive)
if string1.lower != string2.lower then
print "Strings are NOT equal. (case insensitive)"
end if