cedric MARFIL wrote:
OK,
Thanks.
Python made the code easier and shorter using that syntax, but if java takes 
performances just to do the same,
I guess it would be better to use the + syntax:
String firstName = "Cedric";
String a = "Hello " + firstName;
In case of many elements to put in the string, it will render something like 
this:
String a = "Hello " + firstName + ", how are you ? Did you have a good day on " + 
day + ". I guess it will be
better on " + date.toString() + ". See you".

Thanks

string concatenation using + is rather expensive, but it depends where you use it.

for large strings I usually do:

StringBuilder s = new StringBuilder();
s.append("...");
return s.toString()


and to do "real" formatting:

String.format("... %s, ... ", args)

which is closest to python's %

/JM
_______________________________________________
ECM mailing list
[email protected]
http://lists.nuxeo.com/mailman/listinfo/ecm

Reply via email to