When you do any comparison of two strings, the result of the operation is determined by the first difference encountered.
A pair of characters is examine from each pair of strings, starting with the "left most". If they are the same character, the comparison continues with the next pair. If they are different, the comparison of those characters alone determines the result of the whole comparison, so no further characters are even looked at. The result of the character to character comparison will depend on the "font value" - "UPPERCASE" characters are "smaller in value" than "lowercase" ones, so
'A' is less than 'a'.
This may help:
https://alpharithms.s3.amazonaws.com/assets/img/ascii-chart/ascii-table-alpharithms-scaled.jpg[
^] - it doesn't cover the whole character set (Unicode is enormous!) but it gives you enough to see what is going on.
This is particularly relevant if you compare dates as strings: "01-01-2022" is less than "31-12-1945" because the whole comparison resolved to "is the character '0' bigger than the character '3'?"