Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
DAY 036: _STRCMP
#2
For string math, I always equalize my strings before doing anything else.

For example:  What if I input a$ = 99.9 and b$ = 1024?

We check both and see that we have one decimal, with one decimal place, and the largest is a 4 digit number.  Equalizing that, we get:

a$ = "0099.9"
b$ = "1024.0"

NOW, it's fairly obvious which is the largest value -- even when it comes to string comparison.  (They're also easier to add and multiply and such like this, as well, so you're just doing work which needed to be done anyway with your values.)
Reply


Messages In This Thread
DAY 036: _STRCMP - by Pete - 12-16-2022, 07:09 PM
RE: DAY 036: _STRCMP - by SMcNeill - 12-16-2022, 08:00 PM
RE: DAY 036: _STRCMP - by Pete - 12-16-2022, 08:28 PM
RE: DAY 036: _STRCMP - by Pete - 12-17-2022, 06:37 AM



Users browsing this thread: 2 Guest(s)