String comparison

Smee

Well-Known Member
Licensed User
Longtime User
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
Is String comparison implemented? I cannot work out how to test if "abc" < "bbc". it is for sorting purposes

Thanks

Joe

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
Top