To comment on the following update, log in, then open the issue:
http://www.openoffice.org/issues/show_bug.cgi?id=66621
Issue #|66621
Summary|[RFE] please add more sphisticated replace functionali
|ty to ::rtl::OUString
Component|porting
Version|680m172
Platform|All
URL|
OS/Version|All
Status|NEW
Status whiteboard|
Keywords|
Resolution|
Issue type|ENHANCEMENT
Priority|P3
Subcomponent|code
Assigned to|sb
Reported by|fs
------- Additional comments from [EMAIL PROTECTED] Thu Jun 22 02:14:34 -0700
2006 -------
Currently, the functionality to replace parts of an ::rtl::OUString with other
content is rather limited: "replaceAt( int index, int length, string replace )"
and "replace( unicode find, unicode replace )" are the only available methods.
What would be useful is the functionality which today is already present at the
tools/string:
searchAndReplace( unicode find, unicode replace, int startIndex = 0 )
searchAndReplace( string find, string replace, int startIndex = 0 )
searchAndReplace( unicode* find, string replace, int startIndex = 0 )
searchAsciiAndReplace( char* find, string replace, int startIndex = 0 )
All those methods would only replace the first occurance (starting from
|startIndex|) of the searched string/character.
Additionally, versions which replace all occurences might be helpful, named
searchAndReplaceAll. Though, this might conflict with today's naming/semantics
of the existing replace functionality.
Anyway, however this is implemented :), the use case is this:
Loading strings from a resource file, which nowadays is possible below the Tools
module, thus by having ::rtl::OUStrings only, 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. Currently, you must do
something like
::rtl::OUString placeHolder( RTL_CONSTASCII_USTRING_PARAM( "$ibject$" ) );
string.replaceAt( string.indexOf( placeHolder ), placeHolder.getLength(),
replaceString );
This is cumbersome and error prone. Desirable would be something like
string.searchAsciiAndReplace( "$object$", replaceString );
---------------------------------------------------------------------
Please do not reply to this automatically generated notification from
Issue Tracker. Please log onto the website and enter your comments.
http://qa.openoffice.org/issue_handling/project_issues.html#notification
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]