You may be wondering why did I make this? I am sick of writing the same code over and over again, and thought a higher level library would keep me from going crazy.
All of these things are built into a lot of other languages I use; python, php, javascript.
So...
Instead of:
I can:
etc.
All of these things are built into a lot of other languages I use; python, php, javascript.
So...
Instead of:
Code: (Select All)
DIM AS LONG ub, lb, i, n
lb& = LBOUND(source_arr$) : ub& = UBOUND(source_arr$)
IF start_idx% < lb& OR start_idx% + count% > ub& THEN EXIT SUB ' out of range
IF ub& - lb& < count% THEN EXIT SUB ' too many and not enough
REDIM dest_arr(0 TO ABS(count%)) AS STRING
IF SGN(count%) = -1 THEN
IF ((start_idx% - 1) - ABS(count%)) < 0 THEN EXIT SUB ' out of range
n& = 0
FOR i& = (start_idx% - 1) TO ((start_idx% - 1) - ABS(count%)) STEP -1
dest_arr$(n&) = source_arr$(i&)
n& = n& + 1
NEXT i&
ELSE
IF ((start_idx% + 1) + ABS(count%)) > (ub& - lb&) THEN EXIT SUB ' out of range
n& = 0
FOR i& = start_idx% + 1 TO ((start_idx% + 1) + count%) STEP 1
dest_arr$(n&) = source_arr$(i&)
n& = n& + 1
NEXT i&
END IF
I can:
Code: (Select All)
CALL ARR_STR.slice(s1$(), s2$(), 1, 3)
etc.