S Smee Well-Known Member Licensed User Longtime User Aug 6, 2011 #1 Is String comparison implemented? I cannot work out how to test if "abc" < "bbc". it is for sorting purposes Thanks Joe
Is String comparison implemented? I cannot work out how to test if "abc" < "bbc". it is for sorting purposes Thanks Joe
margret Well-Known Member Licensed User Longtime User Aug 6, 2011 #2 Smee said: Is String comparison implemented? I cannot work out how to test if "abc" < "bbc". it is for sorting purposes Thanks Joe Click to expand... Hello Joe, Yes it is! See info below: CompareTo (Other As String) As Int Lexicographically compares the two strings. Returns a value less than 0 if the current string precedes Other. Returns 0 if both strings are equal. Returns a value larger than 0 if the current string comes after Other. Note that upper case characters precede lower case characters. Examples: "abc".CompareTo("da") ' < 0 "abc".CompareTo("Abc") ' > 0 "abc".CompareTo("abca")' < 0 yourvar.CompareTo(yourvar2) Thanks, Margret Upvote 0
Smee said: Is String comparison implemented? I cannot work out how to test if "abc" < "bbc". it is for sorting purposes Thanks Joe Click to expand... Hello Joe, Yes it is! See info below: CompareTo (Other As String) As Int Lexicographically compares the two strings. Returns a value less than 0 if the current string precedes Other. Returns 0 if both strings are equal. Returns a value larger than 0 if the current string comes after Other. Note that upper case characters precede lower case characters. Examples: "abc".CompareTo("da") ' < 0 "abc".CompareTo("Abc") ' > 0 "abc".CompareTo("abca")' < 0 yourvar.CompareTo(yourvar2) Thanks, Margret
nfordbscndrd Well-Known Member Licensed User Longtime User Aug 6, 2011 #3 Smee said: Is String comparison implemented? I cannot work out how to test if "abc" < "bbc". it is for sorting purposes Click to expand... See this page in the Documentation Wiki. Upvote 0
Smee said: Is String comparison implemented? I cannot work out how to test if "abc" < "bbc". it is for sorting purposes Click to expand... See this page in the Documentation Wiki.