Go Back   CodingForums.com > :: Server side development > Java and JSP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 12-09-2004, 09:34 PM   PM User | #1
cwl157
New Coder

 
Join Date: Jun 2003
Posts: 92
Thanks: 0
Thanked 0 Times in 0 Posts
cwl157 is an unknown quantity at this point
char arrays and strings in java

can someone help me convert a char array to a string? Thanks.
cwl157 is offline   Reply With Quote
Old 12-09-2004, 10:03 PM   PM User | #2
KeZZeR
Regular Coder

 
Join Date: Oct 2004
Location: England
Posts: 282
Thanks: 0
Thanked 0 Times in 0 Posts
KeZZeR is an unknown quantity at this point
Just go through each element and add it to a new string using a for loop, le easy.
KeZZeR is offline   Reply With Quote
Old 12-10-2004, 03:30 AM   PM User | #3
turbowrx
New Coder

 
Join Date: Nov 2004
Posts: 54
Thanks: 0
Thanked 0 Times in 0 Posts
turbowrx is an unknown quantity at this point
The string constructor also accepts char arrays, so you could do something like this.

char[] b = {'a', 'b', 'c'};
String abc = new String(b);
turbowrx is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 08:05 PM.


Advertisement
Log in to turn off these ads.