Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

dynamic arrays

 
Thomas Whalen
Ranch Hand
Posts: 123
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
how do i create an array dynamically? i have seen examples of where ArrayB was a copy of ArrayA, but this isn't what I want to do. i want to take a string and create an array that will hold just that string.
thank you,
thomas
 
Marilyn de Queiroz
Sheriff
Posts: 9063
12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thomas,
Have you seen the API for the String class?

You can use the
void getChars(int srcBegin, int srcEnd, char[] dst, int dstBegin)
method which copies characters from this string into the destination character array.


 
Thomas Whalen
Ranch Hand
Posts: 123
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks for the example, i didn't even know to look in that API
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic