diff options
Diffstat (limited to '')
-rw-r--r-- | src/fbasicstring.h | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/src/fbasicstring.h b/src/fbasicstring.h index 0e63efe..1c1f8a2 100644 --- a/src/fbasicstring.h +++ b/src/fbasicstring.h | |||
@@ -1035,6 +1035,28 @@ namespace Bu | |||
1035 | core->clear(); | 1035 | core->clear(); |
1036 | } | 1036 | } |
1037 | 1037 | ||
1038 | MyType replace( const MyType &fnd, const MyType &rep ) const | ||
1039 | { | ||
1040 | MyType out; | ||
1041 | const_iterator o = begin(); | ||
1042 | while( true ) | ||
1043 | { | ||
1044 | const_iterator i = o.find( fnd ); | ||
1045 | if( !i ) | ||
1046 | { | ||
1047 | out.append( o ); | ||
1048 | return out; | ||
1049 | } | ||
1050 | else | ||
1051 | { | ||
1052 | out.append( o, i ); | ||
1053 | out.append( rep ); | ||
1054 | o = i; | ||
1055 | o += fnd.getSize(); | ||
1056 | } | ||
1057 | } | ||
1058 | } | ||
1059 | |||
1038 | /** | 1060 | /** |
1039 | * Force the string to resize | 1061 | * Force the string to resize |
1040 | *@param nNewSize (long) The new size of the string. | 1062 | *@param nNewSize (long) The new size of the string. |