@@ -999,10 +999,58 @@ OFMutableString *new; new = [OFMutableString stringWithString: self]; [new appendString: str]; + /* + * Class swizzle the string to be immutable. We declared the return type + * to be OFString*, so it can't be modified anyway. But not swizzling it + * would create a real copy each time -[copy] is called. + */ + new->isa = [OFString class]; + return new; +} + +- (OFString*)stringByDeletingLeadingWhitespaces +{ + OFMutableString *new; + + new = [OFMutableString stringWithString: self]; + [new deleteLeadingWhitespaces]; + + /* + * Class swizzle the string to be immutable. We declared the return type + * to be OFString*, so it can't be modified anyway. But not swizzling it + * would create a real copy each time -[copy] is called. + */ + new->isa = [OFString class]; + return new; +} + +- (OFString*)stringByDeletingTrailingWhitespaces +{ + OFMutableString *new; + + new = [OFMutableString stringWithString: self]; + [new deleteTrailingWhitespaces]; + + /* + * Class swizzle the string to be immutable. We declared the return type + * to be OFString*, so it can't be modified anyway. But not swizzling it + * would create a real copy each time -[copy] is called. + */ + new->isa = [OFString class]; + return new; +} + +- (OFString*)stringByDeletingLeadingAndTrailingWhitespaces +{ + OFMutableString *new; + + new = [OFMutableString stringWithString: self]; + [new deleteLeadingAndTrailingWhitespaces]; + /* * Class swizzle the string to be immutable. We declared the return type * to be OFString*, so it can't be modified anyway. But not swizzling it * would create a real copy each time -[copy] is called. */