This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes converting string array to string Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

JavaRanch » Java Forums » Java » Beginning Java
Bookmark "converting string array to string" Watch "converting string array to string" New topic

converting string array to string

Aashish Paruthi

Joined: Apr 13, 2003
Posts: 7
I need to convert array of strings to string joined by ','(comma).
I have been trying to use
String []vars;
String someString=arrayToString(vars,',');
I get the following error:
cannot resolve symbol
Balaji Natarajan

Joined: Dec 05, 2002
Posts: 28
Try this...
Aashish Paruthi

Joined: Apr 13, 2003
Posts: 7
Thanks, but I was trying to use a predefined function in util or array class and it would give me as I mentioned "
cannot resolve symbol" . I wanted to know if the method exists or is it deprecated.
Which classes should I import or should I make it work?
Joel McNary

Joined: Aug 20, 2001
Posts: 1824

Two things:
1). Remember, any method call without an object becomes a method call to this. So your call to "arrayToString" is looking for that function in the current class.
2). I don't know of any standard Java class that will do what you are asking to do here. A quick search on Google shows that many people have written this method, but I don't see that this is part of SUN's API.

Piscis Babelis est parvus, flavus, et hiridicus, et est probabiliter insolitissima raritas in toto mundo.
Aashish Paruthi

Joined: Apr 13, 2003
Posts: 7
I got some fundamentals straightened out.
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link:
subject: converting string array to string
It's not a secret anymore!