Compare Two Strings
String comparisons are performed in the same manor as number comparisons. As an example, we will create two strings, and perform an action based on their contents:
Tip: To perform a non-case-sensitive comparison on two strings, use a String.CompareNoCase action.
String comparisons are performed in the same manor as number comparisons. As an example, we will create two strings, and perform an action based on their contents:
- Create two variables containing strings:
Kod:String1 = "I am String1"; String2 = "I am String2";
- Compare the two strings:
Kod:if String1 == String2 then --the two strings are equal else --the two strings are not equal if String1 > String2 then --String1 is alphabetically larger than String2 elseif String1 < String2 then --String1 is alphabetically smaller than String2 end end
Kod:
if String.Length(String1) == String.Length(String2) then
--the two strings are the same length!!
end