What are the rules for string size comparisons?
For example: "Ten", "10a", "a", "abc" How do they sort in ascending descending order?? Ask for rules!!
Reply to discussion (solution)
As far as I know, the rule of comparison between them is: The first letter of the ASCLL size comparison if the same is compared to the second one.
The string size is sorted according to the ASCII of the first character.
As far as I know, the rule of comparison between them is: The first letter of the ASCLL size comparison if the same is compared to the second one.
"Ten", "10a" How do these two compare?
Var_dump (STRNATCMP ("Ten", "10a"));
Int (-1)
means "10a" < "ten"
Reference to the 1 floor nowphp's reply: As far as I know, the rule of comparison between them is: first the ASCLL size comparison of the first letter if the same is compared to the second one.
"Ten", "10a" How do these two compare? And so on, if the second one is equal then the third one ... Nth one.
It seems to be a master AH study
Reference 3 Floor u010044579 's reply:
Reference to the 1 floor nowphp's reply: As far as I know, the rule of comparison between them is: first the ASCLL size comparison of the first letter if the same is compared to the second one.
"Ten", "10a" How do these two compare? And so on, if the second one is equal then the third one ... Nth one.
Still a little do not understand, look in detail: "10" third place No "10a" is a This how to compare?
No, and have you said which big?
What do you have to understand?
Do you understand the ASCII code?
10 Don't you think you should understand?
Do you know what ASCII a means in decimal? Rep 97
ASCII code 0 represents 48 in decimal
1 Rep 49
So 1
10 can be seen as 48 49
10a can be seen as 48 49 97
So the front 2 is the same, the third one is 97, one is none, which one do you mean which is small?
ASCII code 0 represents 48 in decimal
1 Rep 49
So 1
10 can be seen as 48 49
10a can be seen as 48 49 97
So the front 2 is the same, the third one is 97, one is none, which one do you mean which is small?
Okay, I got it, thanks.