meow00
asked on
append things to String ...
Hello experts,
I have a loop like:
String myString = " ";
for(int i=0; i<N; i++){
myString += (String)i*10000; }
the code becomes slower and slower when N gets larger ...
is there any other better way (faster ways) to append things the the String ?
thanks.
I have a loop like:
String myString = " ";
for(int i=0; i<N; i++){
myString += (String)i*10000; }
the code becomes slower and slower when N gets larger ...
is there any other better way (faster ways) to append things the the String ?
thanks.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Keep in mind that StringBuilder is available only in Java 5, so if you have a prior version of Java, you need to stick to StringBuffer.