B4J Question Has anyone written (or am I missing a built in) function that determines if one string is greater than another?

MrKim

Well-Known Member
Licensed User
Longtime User
If VBA you can use
B4X:
If Str1 > Str2 Then ...
While
B4X:
If Str1 = Str2 ...
seems to work the greater than and less than operators do not.
I will write the function if it hasn't been done already.
If I have to write it I am assuming using
B4X:
Dim B1() As Byte = S1.GetBytes("UTF8")
Dim B2() As Byte = S2.GetBytes("UTF8")
And looping through the arrays would be the best way to do it?
 

OliverA

Expert
Licensed User
Longtime User
B4X:
Str1.CompareTo(Str2) ' returns < 0 if Str1 < Str2, 0 if Str1 = Str2 and > 0 if Str1 > Str2
 
Upvote 0
Top