From: Lothar S. <ll...@we...> - 2008-03-28 19:23:09
|
Hello Colin, Friday, March 28, 2008, 7:50:06 PM, you wrote: >>>>>> "Eric" == Eric Bezault <er...@go...> writes: CPA> Eric> Otherwise I try to be very careful with CPA> Eric> strings. String concatenations and substring operations CPA> Eric> create a lot of intermediary objects. Be careful as well CPA> Eric> when strings get resized (even implicitly by some CPA> Eric> operations). CPA> Is there a more efficient way of doing this sort of thing? CPA> a_preceding_path := parent.path CPA> if STRING_.same_string (a_preceding_path, "/") then CPA> Result := STRING_.concat (a_preceding_path, node_name) CPA> else CPA> Result := STRING_.concat (a_preceding_path, "/") CPA> Result := STRING_.appended_string (Result, node_name) CPA> Result := STRING_.appended_string (Result, "[") CPA> Result := STRING_.appended_string (Result, simple_number) CPA> Result := STRING_.appended_string (Result, "]") CPA> end Exactly for this reason some java compilers have a special optimization inside the code generator when it detects sequences of strings concatenations. It's just a to important operation. -- Best regards, Lothar mailto:ll...@we... |