|
Author |
Topic: string arrays in p5 (Read 686 times) |
|
Martin
|
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
|
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
|
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.
|
|
|
|
|