dynamic array

hello

I'm a dummy in java programming and I need your help on the array.

I would like to keep a text in a text area and put it in a char arrray.

and i would like that the array should have the exact size of the word i kept

actually i was use a static array, but it was not good because the when the word was smaller than the array, it complete the array with \u0000.

i think i need to use dynamic array or pointer but i don't know how to use it (declaration, use...)

thanks for you kind support

Best Regards

[559 byte] By [Teo73a] at [2007-11-26 17:35:38]
# 1

There is no such thing as a dynamic array in Java. You need to store a static array and replace it when you need the length to change - this is what collections such as ArrayList do behind the scenes.

Though, that aside, I'd be surprised if you need to store a char[] at all. What are you trying to do?

itchyscratchya at 2007-7-9 0:03:39 > top of Java-index,Desktop,Core GUI APIs...
# 2
you can make your own linked list? or you can usejava.util.Vectorbut not sure why dont you just use A String
Nibura at 2007-7-9 0:03:39 > top of Java-index,Desktop,Core GUI APIs...
# 3

actually i want to communicate with a GPIB device (power supply, multimeter....)

and i want to use a pseudo langage that i have define.

as for example

PW1 GPIB 5;

PW1 is the name of the power supply and 5 the adress of my GPIB power supply.

and i want to keep this information (PW1 and 5) in a char array.

i use this parameter after, to send dedicated GPIB command.

that why

i would like to have an array which have the size of the world i need (PW1 and5).

Teo73a at 2007-7-9 0:03:39 > top of Java-index,Desktop,Core GUI APIs...
# 4
use a linked list, or Vector though a vector is just a static array that copies and moves the elements around. easiest thing
Nibura at 2007-7-9 0:03:39 > top of Java-index,Desktop,Core GUI APIs...
# 5
I would just obtain a new array when you need it, using getText().toCharArray(). No need to keep updating a pseudo dynamic array.
itchyscratchya at 2007-7-9 0:03:39 > top of Java-index,Desktop,Core GUI APIs...
# 6
thank you guys for your helpit works, finally i have used vector.thanks again
Teo73a at 2007-7-9 0:03:39 > top of Java-index,Desktop,Core GUI APIs...