Index: src/OFMutableString.h ================================================================== --- src/OFMutableString.h +++ src/OFMutableString.h @@ -125,28 +125,28 @@ */ - (void)insertString: (OFString*)str atIndex: (size_t)idx; /** - * Removes the characters at the specified range. + * Deletes the characters at the specified range. * * \param start The index where the deletion should be started * \param end The index until which the characters should be deleted. * This points BEHIND the last character! */ -- (void)removeCharactersFromIndex: (size_t)start +- (void)deleteCharactersFromIndex: (size_t)start toIndex: (size_t)end; /** - * Removes the characters at the specified range. + * Deletes the characters at the specified range. * * \param range The range of the characters which should be removed */ -- (void)removeCharactersInRange: (of_range_t)range; +- (void)deleteCharactersInRange: (of_range_t)range; /** - * Removes the characters at the specified range. + * Replaces the characters at the specified range. * * \param start The index where the replacement should be started * \param end The index until which the characters should be replaced. * This points BEHIND the last character! * \param repl The string to the replace the characters with @@ -154,37 +154,37 @@ - (void)replaceCharactersFromIndex: (size_t)start toIndex: (size_t)end withString: (OFString*)repl; /** - * Removes the characters at the specified range. + * Deletes the characters at the specified range. * * \param range The range of the characters which should be replaced * \param repl The string to the replace the characters with */ - (void)replaceCharactersInRange: (of_range_t)range withString: (OFString*)repl; /** - * Replaces all occurrences of a string with another string. + * Deletes all occurrences of a string with another string. * * \param str The string to replace * \param repl The string with which it should be replaced */ - (void)replaceOccurrencesOfString: (OFString*)str withString: (OFString*)repl; /** - * Removes all whitespaces at the beginning of a string. + * Deletes all whitespaces at the beginning of a string. */ -- (void)removeLeadingWhitespaces; +- (void)deleteLeadingWhitespaces; /** - * Removes all whitespaces at the end of a string. + * Deletes all whitespaces at the end of a string. */ -- (void)removeTrailingWhitespaces; +- (void)deleteTrailingWhitespaces; /** - * Removes all whitespaces at the beginning and the end of a string. + * Deletes all whitespaces at the beginning and the end of a string. */ -- (void)removeLeadingAndTrailingWhitespaces; +- (void)deleteLeadingAndTrailingWhitespaces; @end Index: src/OFMutableString.m ================================================================== --- src/OFMutableString.m +++ src/OFMutableString.m @@ -380,11 +380,11 @@ string[nlen] = '\0'; length = nlen; } -- (void)removeCharactersFromIndex: (size_t)start +- (void)deleteCharactersFromIndex: (size_t)start toIndex: (size_t)end { if (isUTF8) { start = of_string_index_to_position(string, start, length); end = of_string_index_to_position(string, end, length); @@ -408,13 +408,13 @@ /* We don't really care, as we only made it smaller */ [e release]; } } -- (void)removeCharactersInRange: (of_range_t)range +- (void)deleteCharactersInRange: (of_range_t)range { - [self removeCharactersFromIndex: range.start + [self deleteCharactersFromIndex: range.start toIndex: range.start + range.length]; } - (void)replaceCharactersFromIndex: (size_t)start toIndex: (size_t)end @@ -503,11 +503,11 @@ [self freeMemory: string]; string = tmp; length = tmp_len; } -- (void)removeLeadingWhitespaces +- (void)deleteLeadingWhitespaces { size_t i; for (i = 0; i < length; i++) if (string[i] != ' ' && string[i] != '\t' && @@ -525,11 +525,11 @@ /* We don't really care, as we only made it smaller */ [e release]; } } -- (void)removeTrailingWhitespaces +- (void)deleteTrailingWhitespaces { size_t d; char *p; d = 0; @@ -550,11 +550,11 @@ /* We don't really care, as we only made it smaller */ [e release]; } } -- (void)removeLeadingAndTrailingWhitespaces +- (void)deleteLeadingAndTrailingWhitespaces { size_t d, i; char *p; d = 0; Index: src/OFXMLParser.m ================================================================== --- src/OFXMLParser.m +++ src/OFXMLParser.m @@ -351,11 +351,11 @@ [cache appendCStringWithoutUTF8Checking: buf + *last length: *i - *last]; pi = [[cache mutableCopy] autorelease]; len = [pi length]; - [pi removeCharactersFromIndex: len - 1 + [pi deleteCharactersFromIndex: len - 1 toIndex: len]; /* * Class swizzle the string to be immutable. We pass it as * OFString*, so it can't be modified anyway. But not swizzling @@ -630,11 +630,11 @@ if ((len = *i - *last) > 0) [cache appendCStringWithoutUTF8Checking: buf + *last length: len]; - [cache removeLeadingAndTrailingWhitespaces]; + [cache deleteLeadingAndTrailingWhitespaces]; cache_c = [cache cString]; cache_len = [cache cStringLength]; if ((tmp = memchr(cache_c, ':', cache_len)) != NULL) { attrName = [[OFString alloc] initWithCString: tmp + 1 @@ -812,11 +812,11 @@ [cache appendCStringWithoutUTF8Checking: buf + *last length: *i - *last]; cdata = [[cache mutableCopy] autorelease]; len = [cdata length]; - [cdata removeCharactersFromIndex: len - 2 + [cdata deleteCharactersFromIndex: len - 2 toIndex: len]; /* * Class swizzle the string to be immutable. We pass it as OFString*, so * it can't be modified anyway. But not swizzling it would create a @@ -882,11 +882,11 @@ [cache appendCStringWithoutUTF8Checking: buf + *last length: *i - *last]; comment = [[cache mutableCopy] autorelease]; len = [comment length]; - [comment removeCharactersFromIndex: len - 2 + [comment deleteCharactersFromIndex: len - 2 toIndex: len]; /* * Class swizzle the string to be immutable. We pass it as OFString*, so * it can't be modified anyway. But not swizzling it would create a Index: tests/OFStringTests.m ================================================================== --- tests/OFStringTests.m +++ tests/OFStringTests.m @@ -340,16 +340,16 @@ @"#1", OFInvalidEncodingException, [@"foo%bar" stringByURLDecoding]) EXPECT_EXCEPTION(@"Detect invalid encoding in -[stringByURLDecoding] " @"#2", OFInvalidEncodingException, [@"foo%FFbar" stringByURLDecoding]) - TEST(@"-[removeCharactersFromIndex:toIndex:]", + TEST(@"-[deleteCharactersFromIndex:toIndex:]", (s[0] = [OFMutableString stringWithString: @"π„žΓΆΓΆΓΆbÀ€"]) && - R([s[0] removeCharactersFromIndex: 1 - toIndex: 4]) && + R([s[0] deleteCharactersFromIndex: 1 + toIndex: 4]) && [s[0] isEqual: @"π„žbÀ€"] && - R([s[0] removeCharactersFromIndex: 0 + R([s[0] deleteCharactersFromIndex: 0 toIndex: 4]) && [s[0] isEqual: @""]) TEST(@"-[replaceCharactersFromIndex:toIndex:withString:]", (s[0] = [OFMutableString stringWithString: @"π„žΓΆΓΆΓΆbÀ€"]) && @@ -361,24 +361,24 @@ toIndex: 7 withString: @""]) && [s[0] isEqual: @""]) EXPECT_EXCEPTION(@"Detect OoR in " - @"-[removeCharactersFromIndex:toIndex:] #1", OFOutOfRangeException, + @"-[deleteCharactersFromIndex:toIndex:] #1", OFOutOfRangeException, { s[0] = [OFMutableString stringWithString: @"π„žΓΆΓΆ"]; [s[0] substringFromIndex: 2 toIndex: 4]; }) EXPECT_EXCEPTION(@"Detect OoR in " - @"-[removeCharactersFromIndex:toIndex:] #2", OFOutOfRangeException, + @"-[deleteCharactersFromIndex:toIndex:] #2", OFOutOfRangeException, [s[0] substringFromIndex: 4 toIndex: 4]) EXPECT_EXCEPTION(@"Detect s > e in " - @"-[removeCharactersFromIndex:toIndex:]", + @"-[deleteCharactersFromIndex:toIndex:]", OFInvalidArgumentException, [s[0] substringFromIndex: 2 toIndex: 0]) TEST(@"-[replaceOccurrencesOfString:withString:]", @@ -390,30 +390,30 @@ (s[0] = [OFMutableString stringWithString: @"XX"]) && R([s[0] replaceOccurrencesOfString: @"X" withString: @"XX"]) && [s[0] isEqual: @"XXXX"]) - TEST(@"-[removeLeadingWhitespaces]", + TEST(@"-[deleteLeadingWhitespaces]", (s[0] = [OFMutableString stringWithString: whitespace[0]]) && - R([s[0] removeLeadingWhitespaces]) && + R([s[0] deleteLeadingWhitespaces]) && [s[0] isEqual: @"asd \t \t\t\r\n"] && (s[0] = [OFMutableString stringWithString: whitespace[1]]) && - R([s[0] removeLeadingWhitespaces]) && [s[0] isEqual: @""]) + R([s[0] deleteLeadingWhitespaces]) && [s[0] isEqual: @""]) - TEST(@"-[removeTrailingWhitespaces]", + TEST(@"-[deleteTrailingWhitespaces]", (s[0] = [OFMutableString stringWithString: whitespace[0]]) && - R([s[0] removeTrailingWhitespaces]) && + R([s[0] deleteTrailingWhitespaces]) && [s[0] isEqual: @" \r \t\n\t \tasd"] && (s[0] = [OFMutableString stringWithString: whitespace[1]]) && - R([s[0] removeTrailingWhitespaces]) && [s[0] isEqual: @""]) + R([s[0] deleteTrailingWhitespaces]) && [s[0] isEqual: @""]) - TEST(@"-[removeLeadingAndTrailingWhitespaces]", + TEST(@"-[deleteLeadingAndTrailingWhitespaces]", (s[0] = [OFMutableString stringWithString: whitespace[0]]) && - R([s[0] removeLeadingAndTrailingWhitespaces]) && + R([s[0] deleteLeadingAndTrailingWhitespaces]) && [s[0] isEqual: @"asd"] && (s[0] = [OFMutableString stringWithString: whitespace[1]]) && - R([s[0] removeLeadingAndTrailingWhitespaces]) && + R([s[0] deleteLeadingAndTrailingWhitespaces]) && [s[0] isEqual: @""]) TEST(@"-[stringByXMLEscaping]", (s[0] = (id)[@" &world'\"!&" stringByXMLEscaping]) && [s[0] isEqual: @"<hello> &world'"!&"])