It can be summarized like this: when comparing invalid octal or hexadecimal numbers:
1. When the string to be compared does not contain "-": when comparing an invalid number with a string that does not contain "-", character comparison is performed.
2. When the first character of the string to be compared is only "-": if the invalid number is the same as the characters after "-", the invalid number is smaller.
3. When the string to be compared contains "-" and is not the above situation: compare the invalid number with the string obtained by removing all "-" (allowing the result after removing all "-" to be empty) character by character.
I think this example should best illustrate the problem of "-" being removed and all "-" being removed during the comparison of invalid numbers.
[ Last edited by Hanyeguxing on 2009-10-6 at 20:03 ]
1. When the string to be compared does not contain "-": when comparing an invalid number with a string that does not contain "-", character comparison is performed.
2. When the first character of the string to be compared is only "-": if the invalid number is the same as the characters after "-", the invalid number is smaller.
3. When the string to be compared contains "-" and is not the above situation: compare the invalid number with the string obtained by removing all "-" (allowing the result after removing all "-" to be empty) character by character.
@echo off
if 0 GTR - (
if 0899 LSS 08990 echo OK1
if 0899 LSS -0899 echo OK2
if 0899 LSS 0--9 echo OK3
if 0899 LSS -0-9 echo OK4
if 0899 LSS ---- echo OK5
)
pauseI think this example should best illustrate the problem of "-" being removed and all "-" being removed during the comparison of invalid numbers.
[ Last edited by Hanyeguxing on 2009-10-6 at 20:03 ]
Recent Ratings for This Post
( 1 in total)
Click for details
| Rater | Score | Time |
|---|---|---|
| wxcute | +2 | 2009-10-04 19:09 |




