FAQ
Cover
This is the archive Discourse for the Processing (ALPHA) software.
Please visit the new Processing forum for current information.

   Processing 1.0 _ALPHA_
   Programming Questions & Help
   Syntax
(Moderators: fry, REAS)
   string arrays in p5
« Previous topic | Next topic »

Pages: 1 
   Author  Topic: string arrays in p5  (Read 686 times)
Martin

122417302122417302martingomez_listsmg1ph WWW Email
string arrays in p5
« on: Oct 28th, 2002, 5:58pm »

In the beginning...
 
String[] myStringObject = new String[10];
myStringObject[1] = "Hi!";
println( myStringObject[1] );
 
 
Hello,
 
Is the String class / data type completely overridden in Proce55ing?
 
I tried to get around this and used StringBuffer but I wasn't permitted. So, I created my own String class called StringArray...
 
class StringArray {
  StringArray( String stringContents ) {
    // stuff goes here
  }
  // and here...
}
 
and tried to use it...
 
StringArray myStringObject = new StringArray[10];
myStringObject[1] = "Hi!";
println( myStringObject[1] );
 
but it wouldn't work for the same reason with StringBuffer... because of the double quotes.
 
Hmm... Aside from directly hacking the exported .java file, is there a way to get around this within the P5 environment? Any thoughts on this?
 
Thanks!
 
fry


WWW
Re: string arrays in p5
« Reply #1 on: Oct 28th, 2002, 8:28pm »

hi,
 
i just tried the code you mention at the top and it works fine. are you getting an error?
 
fwiw, we don't mess with the String class..
 
you should be able to assign strings to an array with no problem. the only problem is where you want to modify an existing String, and that's just inhereited from java (where you have to use StringBuffer, as you mention).
 
Martin

122417302122417302martingomez_listsmg1ph WWW Email
Re: string arrays in p5
« Reply #2 on: Oct 29th, 2002, 12:39am »

whoa. it works fine now. hhhmm... i wonder what happened yesterday evening. got something like "... this line has to use java.lang.String" ... oh well. i'll post the exact error mssg if i come across this again. thanks ben.
 
Pages: 1 

« Previous topic | Next topic »