Overview
Comment: | Add -[OFMutableString insertString:atIndex:]. |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
e9db0f7013fd039b8b62ffc57fb509ac |
User & Date: | js on 2010-10-24 22:32:03 |
Other Links: | manifest | tags |
Context
2010-10-24
| ||
23:31 | Compare blocks to NULL instead of nil. Some old clang revs require this. check-in: 39f8e079ef user: js tags: trunk | |
22:32 | Add -[OFMutableString insertString:atIndex:]. check-in: e9db0f7013 user: js tags: trunk | |
22:12 | Add -[OFMutableString replaceCharactersFromIndex:toIndex:withString:]. check-in: 3f14a43fbf user: js tags: trunk | |
Changes
Modified src/OFMutableString.h from [c820e5e0d0] to [e64875b198].
︙ | ︙ | |||
101 102 103 104 105 106 107 108 109 110 111 112 113 114 | - (void)upper; /** * Lower the OFString. */ - (void)lower; /** * Removes 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! */ | > > > > > > > > > | 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 | - (void)upper; /** * Lower the OFString. */ - (void)lower; /** * Inserts a string at the specified index. * * \param str The string to insert * \param idx The index */ - (void)insertString: (OFString*)str atIndex: (size_t)idx; /** * Removes 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! */ |
︙ | ︙ |
Modified src/OFMutableString.m from [4f2f2b15be] to [a7c6aaf7d8].
︙ | ︙ | |||
349 350 351 352 353 354 355 356 357 358 359 360 361 362 | } - (void)lower { [self _applyTable: of_unicode_lower_table withSize: OF_UNICODE_LOWER_TABLE_SIZE]; } - (void)removeCharactersFromIndex: (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); | > > > > > > > > > > > > > > > > > > > > > > | 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 | } - (void)lower { [self _applyTable: of_unicode_lower_table withSize: OF_UNICODE_LOWER_TABLE_SIZE]; } - (void)insertString: (OFString*)str atIndex: (size_t)idx { size_t nlen; if (isUTF8) idx = of_string_index_to_position(string, idx, length); if (idx > length) @throw [OFOutOfRangeException newWithClass: isa]; nlen = length + [str cStringLength]; string = [self resizeMemory: string toSize: nlen + 1]; memmove(string + idx + [str cStringLength], string + idx, length - idx); memcpy(string + idx, [str cString], [str cStringLength]); string[nlen] = '\0'; length = nlen; } - (void)removeCharactersFromIndex: (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); |
︙ | ︙ |
Modified tests/OFStringTests.m from [1aeb17e075] to [eb03c62ab2].
︙ | ︙ | |||
271 272 273 274 275 276 277 278 279 280 281 282 283 284 | TEST(@"-[stringByURLEncoding]", [[@"foo\"ba'_~$" stringByURLEncoding] isEqual: @"foo%22ba%27_~%24"]) TEST(@"-[stringByURLDecoding]", [[@"foo%20bar%22+%24" stringByURLDecoding] isEqual: @"foo bar\" $"]) EXPECT_EXCEPTION(@"Detect invalid encoding in -[stringByURLDecoding] " @"#1", OFInvalidEncodingException, [@"foo%bar" stringByURLDecoding]) EXPECT_EXCEPTION(@"Detect invalid encoding in -[stringByURLDecoding] " @"#2", OFInvalidEncodingException, [@"foo%FFbar" stringByURLDecoding]) TEST(@"-[removeCharactersFromIndex:toIndex:]", | > > > > > > | 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 | TEST(@"-[stringByURLEncoding]", [[@"foo\"ba'_~$" stringByURLEncoding] isEqual: @"foo%22ba%27_~%24"]) TEST(@"-[stringByURLDecoding]", [[@"foo%20bar%22+%24" stringByURLDecoding] isEqual: @"foo bar\" $"]) TEST(@"-[insertString:atIndex:]", (s[0] = [OFMutableString stringWithString: @"πΓΆΓΆΓΆbΓ€β¬"]) && R([s[0] insertString: @"Àâü" atIndex: 3]) && [s[0] isEqual: @"πââÀâüâbΓ€β¬"]) EXPECT_EXCEPTION(@"Detect invalid encoding in -[stringByURLDecoding] " @"#1", OFInvalidEncodingException, [@"foo%bar" stringByURLDecoding]) EXPECT_EXCEPTION(@"Detect invalid encoding in -[stringByURLDecoding] " @"#2", OFInvalidEncodingException, [@"foo%FFbar" stringByURLDecoding]) TEST(@"-[removeCharactersFromIndex:toIndex:]", |
︙ | ︙ |