We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpSyntax Questions › Define Empty String Array
Page Index Toggle Pages: 1
Define Empty String Array? (Read 281 times)
Define Empty String Array?
Dec 2nd, 2007, 5:17pm
 
Sorry i couldn't find the answer on the board:

I want to define a String Array at the start of the programm, but it should be empty, since i will fill it later and i also don't know how many entries there will be.

But it only works when i define a number of entries at the beginning?

String [] nameXY = new String[20000];

But i would like to have it:

String [] nameXY = new String[];
...
nameXY[i] = "Someentry";
...
nameXY.length = the actual number of entries

So after i filled it i can ask for its length.
Can somebody tell me how to do this?

Thanks a ot

Re: Define Empty String Array?
Reply #1 - Dec 2nd, 2007, 5:25pm
 
ok, got it, sorry for the post:

String nameXY[] = {};

nameXY = append(nameXY,"string");
Page Index Toggle Pages: 1