For a complete comparison of Unicode strings, you should use the localeCompare method:
var compare:int = a.localeCompare(b);
It will return the alphabetical difference between the two first two letters (whether the other letter is the first or any other) or zero if the strings are identical. The number will be negative if "a" is the first in the alphabet, or positive if it is "b" first.
So you will need to check:
compare < 0 (first appears "a")
compare == 0 (identical lines)
compare > 0 ("b" first appears)
You must also make sure that both a and b have lowercase letters in advance (or both are uppercase, it doesnβt matter, but both should be in the same case), because localeCompare thinks that uppercase and lowercase letters are completely different alphabets (this is because this method compares the Unicode character table, the uppercase letter begins).
source share