Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

String Splitting [ and Joining ]

Status
Not open for further replies.

flanakin

Programmer
Mar 21, 2000
158
US
I know how to split strings...

strSomething.split( strDelimiter );

But how can I join one? Most other languages that use a split() method also have a join() method. Maybe there is none. I wouldn't be surprised - with the quality of Sun's work and all. I can't believe it took them this long just to get a freakin' split method - new as of 1.4. Anyway, thanks in advance. ________________________________________
Michael C Flanakin
Indigo Web Systems
michael.flanakin@indigows.com
 
Sun calls the method of joining 2 strings concat(), which has been available since atleast jdk1.1.4, the first jdk I used in 1998.

e.g:
String s1 = "s11111", s2 = "s22222";
String s3 = s1.concat(s2);
System.out.println(s3);

will output s11111s22222
 
I know what concat is. What I am refering to is joining an array of strings. I appologize for not explaining that correctly. But, if you can split a string into an array of strings, why can you not join the array back together? From what I see, you cannot in Java (without your own methods). I would like to think there is a way, but I cannot find one. ________________________________________
Michael C Flanakin
Indigo Web Systems
michael.flanakin@indigows.com
 
Try:
strArr = strSomething.split( strDelimiter );
strArr.toString();
Coding is the worst thing I had done.
 
Ok...Haven't tried that. If that works, tho, then that'll be great. Thanks. ________________________________________
Michael C Flanakin
Indigo Web Systems
michael.flanakin@indigows.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top