Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Miscellaneous handy goodies
#4
+1 on Steve's _MEM comment, and he is the _MEM guru here...

I particularly like it for manipulating all sorts of arrays; integers, longs, fixed length strings, UDTs, etc.

BTW, here is how I generally approach integer value limiting.

Code: (Select All)
'Limit an integer argument to a maximum value
FUNCTION MaxOf% (value AS INTEGER, max AS INTEGER)
    MaxOf% = -value * (value <= max) - max * (value > max)
END FUNCTION 'MaxOf%

'Limit an integer argument to a minimum value
FUNCTION MinOf% (value AS INTEGER, minimum AS INTEGER)
    MinOf% = -value * (value >= minimum) - minimum * (value < minimum)
END FUNCTION 'MinOf%

'Limit an integer argument between minimum and maximum bounds
FUNCTION MinMax% (value AS INTEGER, min AS INTEGER, max AS INTEGER)
    MinMax% = MaxOf%(MinOf%(value, min), max)
END FUNCTION 'MinMax%
DO: LOOP: DO: LOOP
sha_na_na_na_na_na_na_na_na_na:
Reply


Messages In This Thread
Miscellaneous handy goodies - by grymmjack - 12-28-2022, 01:44 AM
RE: Miscellaneous handy goodies - by grymmjack - 12-28-2022, 01:46 AM
RE: Miscellaneous handy goodies - by SMcNeill - 12-28-2022, 03:55 AM
RE: Miscellaneous handy goodies - by madscijr - 12-28-2022, 11:56 PM
RE: Miscellaneous handy goodies - by OldMoses - 12-28-2022, 01:41 PM
RE: Miscellaneous handy goodies - by mdijkens - 12-28-2022, 03:37 PM
RE: Miscellaneous handy goodies - by mnrvovrfc - 03-27-2023, 06:22 PM
RE: Miscellaneous handy goodies - by aurel - 04-02-2023, 05:01 PM



Users browsing this thread: 1 Guest(s)