ClearArrayCells
ClearArrayCells SourceArray(), StartElement, ElementDelta, Number, FillValue_Or_String
 
Parameters:

    SourceArray() = The Array you wish to clear
    StartElement = The address of starting element
    ElementDelta = The difference between elements
    Number = The number of elements you wish to clear
    FillValue_Or_String = The Value or String you wish to fill this array with.
Returns: NONE
 

      ClearArrayCells can clear a section of an array with either a value or a string. So ClearArrayCells can be used upon not only Integer and floating point arrays, but String$ and Typed Arrays also. However the data type of FillValue (int/float/string) must match the type of the array you wish to fill. So you can only fill an integer array with integer values.

      One the most powerful features of PlayBASICs array commands, is their unique ability to manipulate the data within any type of array of any dimension. So these commands wil work upon 1D arrays, 2D, 3D etc etc.



FACTS:


      * ClearArrayCells can be used upon Integer, Floating Point, String and Type arrays.

      * ClearArrayCells is much faster than manually clearing array elements yourself.

      * When Clearing elements within a Typed Array. ClearArrayCells will deallocate any over written elements for you.



Mini Tutorial:


      Filling an Integer Array with the value 1000.

  
; Create a 1D Array...
  Dim Table(10)
  
; Clear the Table() Array with the Value 1000
  
; Array(), Starting Pos, Stepping Value, Steps, CkearValue
  ClearArrayCells Table(),3,1,5,100
  
; Display the table() array
  For lp =0 To 10
     Print Table(lp)
  Next
  
; Show the Display and wait for a key press
  Sync
  WaitKey
  
  


This example would output.

  
  0
  0
  0
  100
  100
  100
  100
  100
  0
  0
  0
  




Filling some STRING Array cells with the string "Hello World"

  
  
; Create a string array...
  Dim StringTable$(10)
  
; Fill the StringTable() Array with "Hello World"
  ClearArrayCells StringTable$(),4,1,5,"Hello World"
  
; Display the StringTable$() array
  For lp =0 To 10
     Print Str$(lp)+">>"+StringTable$(lp)
  Next
  
  
; Show the Display and wait for a key press
  Sync
  WaitKey
  
  
  


This example would output.

  
  0>>
  1>>
  2>>
  3>>
  4>>Hello World
  5>>Hello World
  6>>Hello World
  7>>Hello World
  8>>Hello World
  9>>
  10>>
  


 
Related Info: ClearArray | FreeCell | GetFreeCell :
 


(c) Copyright 2002 - 2024 - Kevin Picone - PlayBASIC.com