StrOps::Replace( StrBuf &, const StrPtr &, const StrPtr &, const StrPtr & )
Replace substrings in a StrPtr
and store the result to a
StrBuf
.
Virtual? |
No |
|
Class |
||
Arguments |
|
the output string |
|
the input string |
|
|
the substring to match |
|
|
the substring to replace |
|
Returns |
|
Notes
This function reads the input string i
and copies it to the
output string o
, after replacing each occurrence of the
string s
with string r
.
Example
StrBuf i = StrBuf(); i.Set( "PerForce is PerForce, of course, of course!" ); StrBuf wrong, right; wrong.Set( "PerForce" ); right.Set( "Perforce" ); StrBuf o = StrBuf(); StrOps::Replace( o, i, wrong, right ); StrOps::Dump( o );
Executing the preceding code produces the following output:
% a.out Perforce is Perforce, of course, of course!