Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

 
 
Thread Tools Display Modes
Prev Previous Post in Thread   Next Post in Thread Next
Old Apr 7th, 2008, 6:41 PM   #1
Arla
Hobbyist Programmer
 
Join Date: Mar 2005
Posts: 223
Rep Power: 4 Arla is on a distinguished road
The immutability of strings

Quick question...

Just having read through stuff recently and trying to be a little more concious of efficiency in my programs I wasn't sure about this.

I know that having the following
String test = "James";
test += " is testing this";

Actually creates two strings, and it's better to use stringbuilder class to do this type of thing.

However, does this

String test = "James" + " is testing this";

Create one or two strings? I would assume one, but you know what they say about assuming!
Arla is offline   Reply With Quote
 

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

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

Similar Threads
Thread Thread Starter Forum Replies Last Post
Splitting strings into other strings Keiro C 2 Dec 11th, 2006 6:10 AM
inserting strings into other strings codylee270 C 2 Dec 3rd, 2005 9:37 PM
Question about multidimensional arrays of strings aznluvsmc C 8 Oct 15th, 2005 10:20 PM
creating Strings pleasehelpmeeee Java 5 Sep 26th, 2005 8:03 PM
pointers strings, and strcat() conbrio C 3 Apr 16th, 2005 1:23 PM




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 3:48 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC