Index: src/OFString.h ================================================================== --- src/OFString.h +++ src/OFString.h @@ -594,10 +594,21 @@ * \param string The string to prepend * \return A new autoreleased OFString with the specified string prepended */ - (OFString*)stringByPrependingString: (OFString*)string; +/** + * Creates a new string by replacing the occurrences of the specified string + * with the specified replacement. + * + * \param string The string to replace + * \param replacement The string with which it should be replaced + * \return A new string with the occurrences of the specified string replaced + */ +- (OFString*)stringByReplacingOccurrencesOfString: (OFString*)string + withString: (OFString*)replacement; + /** * \return The string in uppercase */ - (OFString*)uppercaseString; Index: src/OFString.m ================================================================== --- src/OFString.m +++ src/OFString.m @@ -1430,10 +1430,23 @@ { OFMutableString *new = [[string mutableCopy] autorelease]; [new appendString: self]; + [new makeImmutable]; + + return new; +} + +- (OFString*)stringByReplacingOccurrencesOfString: (OFString*)string + withString: (OFString*)replacement +{ + OFMutableString *new = [[self mutableCopy] autorelease]; + + [new replaceOccurrencesOfString: string + withString: replacement]; + [new makeImmutable]; return new; }