StringBuilder has some extra options, like StringBuilder.append(String); They're both the same, regarding speed.

09-08-2008, 09:49 AM

daGame

Quote:

Originally Posted by j2vdk

what is the differences between string and string builder??

I recomend you to google around for such simple questions, that saves your time too, take a look on how many hits you will receive when you search for them. ;)

regards,

daGame

09-08-2008, 09:50 AM

masijade

Quote:

Originally Posted by Supamagier

StringBuilder has some extra options, like StringBuilder.append(String); They're both the same, regarding speed.

Actually, if you are building a String using all, or at least mostly, String literals, then simple String and + is faster (as most, if not all, of those operations will be optimized away by the compiler). However, if you are doing alot of String manipulation actions (additions, insertions, modifications, etc, etc) then StringBuilder is faster (not String Buffer as that is "thread-safe", so there is a lot of unnecessary syncs if threadedness doesn't factor into it's use in that situation).

The difference between String operations and StringBuilder is, however, minimal and not likely to make any difference, unless you are performing a few thousand such operations per second.