Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Arrays
#6
Function ArrayStrRemoveRow
Code:
Copy      Help
;/
function ARRAY(str)&a row

;Removes one row from 2-dim str array.
;Error if some argument is invalid.


if(a.ndim!=2 or row<a.lbound or row>a.ubound) end ES_BADARG

str* b=&a[a.lbound(1) row]
int i inrow=a.len(1)
for(i 0 inrow) b[i].all

inrow*sizeof(str)
int nmove=a.ubound-row*inrow
if(nmove) memmove b b+inrow nmove; memset &a[a.lbound(1) a.ubound] 0 inrow

a.redim(a.len-1 a.lbound)

err+ end _error

example
Macro
Code:
Copy      Help
out
ARRAY(str) a.create(2 4) ;;2 columns, 4 rows
int i
for i a.lbound a.ubound+1
,a[0 i]=i
,a[1 i]=i+10

ArrayStrRemoveRow a 1

for i a.lbound a.ubound+1
,out "%s %s" a[0 i] a[1 i]


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)