• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

converting String to an array

 
Bhasker Reddy
Ranch Hand
Posts: 176
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i have a string
parameter_name = invoice number, file name, userid
how do i convert this to an array, and use array index
to get each of three values separately
 
Kareem Gad
Ranch Hand
Posts: 89
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
you may want to consider using StringTokenizer class
check the javadoc for the methods of this class
------------------
KaReEm
 
Mike Curwen
Ranch Hand
Posts: 3695
IntelliJ IDE Java Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you have a string like this:
String parameter_name = "546787,File21C,45";
Then use a StringTokenizer to break this into three different strings. Something like:
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic