• Post Reply Bookmark Topic Watch Topic
  • New Topic

Array Question  RSS feed

 
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can you take a string of words and stuff each char of the string into an array? If so how do you go about doing it?
 
Ranch Hand
Posts: 89
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try looking at toCharArray in the String API
 
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
String.toCharArray()
 
Jason Batchelder
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That one's that's not in my book, can you give me an example on how to use it? Just a generic would do, please.

Does it go something like this?

s=phrase.toCharArray()
 
(instanceof Sidekick)
Ranch Hand
Posts: 8791
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yup, where s is a char[]. Learn to love the JavaDoc for the API. It sometimes takes a little digging to find what you want, but there is a lot of good stuff there. Take some time to just browser around in there now & then.
 
Jason Batchelder
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the help
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!