FAQ
 
 
Cover  \ Exhibition  \ Learning  \ Reference  \ Download  \ Discourse   
      Language \ Environment \ Libraries \ Comparison
 
   
   
Abridged (A-Z) \ Complete (A-Z)  
   
  Reference for Processing (BETA) version 91+. If you have a previous version, use the reference included with your software. If you see any errors or have any comments, let us know.  
Name  

subset()

   
Examples  
String sa1[] = { "OH ", "NY ", "CA ", "VA ", "CO ", "IL "}; 
String sa2[] = subset(sa1, 1); 
print(sa2);  // Prints "NY CA VA CO IL " 
println(); 
String sa3[] = subset(sa1, 2, 3); 
print(sa3);  // Prints "CA VA CO " 

Description   Extracts an array of elements from an existing array. The array parameter defines the array from which the elements will be copied and the offset and length parameters determine which elements to extract. If no length is given, elements will be extracted from the offset to the end of the array. When specifying the offset remember the first array element is 0. This function does not change the source array.
   
Syntax  
subset(array, offset)
subset(array, offset, length)
   
Parameters  
array   booleans[], bytes[], chars[], ints[], floats[], or Strings[]: base array

offset   int: position to begin

length   int: number of values to extract

   
Returns   Array (the same datatype as the input)
   
Usage   Web & Application
   
Related   splice()
 
 






   
 
Updated: Fri Jul 15 16:36:13 PDT 2005
 
 








Creative Commons License
 
  Processing is an open project initiated by Ben Fry and Casey Reas  
  © Info