Compare Strings (LogiX node)
This node takes two strings and a
StringComparison as input, and it outputs an integer. The
StringComparison can be any one of the StringComparer properties in C#. It is highly recommended to avoid using the
CurrentCulture properties as this means the string may be parsed differently depending on the locale of the user.
If you are not using an
Ordinal comparison, the node will output
-1 depending on if the first string is longer or shorter than the second, respectively. If both strings are of equal length, it will compare each character in both strings and stop if two characters differ from the strings. If it stops, the node will output
1 depending on if the first string's character is of lower or higher value than the second string's character, respectively. Finally, if both strings are equal, it will output
If you are using an
Ordinal comparison, the node will compare each character of both strings first. If it finds a difference between the two strings, it will output the integer difference between the first two differing characters. If both strings are equal up to the end of one, but one contains more characters than the other, it will output the difference between the length of the first input and the length of the second input. Finally, if both strings are equal, it outputs
If you are using a comparison that has
IgnoreCase, the node will not account for case differences when comparing the two strings.