Hi all,
<http://www.openoffice.org/issues/show_bug.cgi?id=66621> is a request to
add searchAndReplace functionality to rtl::OUString, giving the
following use case: "Loading strings from a resource file [...] often
requires to replace certain parts of the loaded string with
runtime-dependent content. For instance, a resource might contain an
error message string 'The object $object$ could not be found.', where
$object$ would be filled in at runtime."
Now, being the pain in the neck that I am, I wonder whether solving the
above via a hypothetic
newStr = oldStr.searchAndReplace("$object$", whatever);
would generally be useful. In general, some searchAndReplace would not
work at least in the following two scenarios:
1 When there is more than one token (e.g., "$object1$", "$object2$",
...) to replace in oldStr, and the replacements may contain text that
looks like one of the tokens (but must not be replaced).
2 When there is an escape mechanism so that oldStr can contain text
that looks like a token but is not replaced with a token (e.g.,
"\$object1$" would not expand to "\"+whatever, but to verbatim "$object1$").
IMO, a well-engineered framework to replace parts of resource strings
with dynamic content would allow for both multiple tokens and an escape
mechanism, so could not use the hypothetic rtl::OUString searchAndReplace.
So, *is* there need for rtl::OUString searchAndReplace?
-Stephan
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]