topical media & game development

talk show tell print

graphic-processing-algorithm-Ch01-p29-p29.pde / pde



  String [] s = new String[0]; //new empty array
  s = append(s,"Kostas");
  s = append(s,"Nashid");
  s = append(s,"Jie Eun");
  print(s.length); //should be 3
  for(int i=0; i<s.length; i++)
    print(s[i] + ", ");
  // should be: Kostas, Nashid, Jie Eun,
  s = sort(s);
  for(int i=0; i<s.length; i++)
    print(s[i] + ", ");
  // should be: Jie Eun, Kostas, Nashid,
  s = subset(s,1,2);
  print(s.length); //should be 2
  for(int i=0; i<s.length; i++)
    print(s[i] + ", ");
  // should be: Kostas, Nashid,
  s = expand(s,5);
  print(s.length); //should be 5
  for(int i=0; i<s.length; i++)
    print(s[i] + ", ");
  // should be: Kostas, Nashid, null, null, null,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
  


(C) Æliens 04/09/2009

You may not copy or print any of this material without explicit permission of the author or the publisher. In case of other copyright issues, contact the author.