OK, Thank you all, JM showed me exalctly what I was looking for. I'll test it as soon as possible.
Thanks again. Cédric From"Jean-Marc Orliaguet" [EMAIL PROTECTED] To"cedric MARFIL" [EMAIL PROTECTED] Cc"fg" [EMAIL PROTECTED],"ecm" [email protected] DateFri, 22 Dec 2006 16:22:39 +0100 SubjectRe: [Ecm] % Notation in java > 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 This message contains information that may be privileged or confidential and is the property of the Capgemini Group. It is intended only for the person to whom it is addressed. If you are not the intended recipient, you are not authorized to read, print, retain, copy, disseminate, distribute, or use this message or any part thereof. If you receive this message in error, please notify the sender immediately and delete all copies of this message.
_______________________________________________ ECM mailing list [email protected] http://lists.nuxeo.com/mailman/listinfo/ecm
