Overview
Comment: | Add -[stringByPrependingString:] to OFString. |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
5b7d19e956b3e2d60e3befc0e775a32e |
User & Date: | js on 2011-06-05 20:45:52 |
Other Links: | manifest | tags |
Context
2011-06-05
| ||
21:26 | Serialize floats and doubles in a format that does not lose precision. check-in: ac2714dd86 user: js tags: trunk | |
20:45 | Add -[stringByPrependingString:] to OFString. check-in: 5b7d19e956 user: js tags: trunk | |
19:27 | Add OFNull class. check-in: 183825f113 user: js tags: trunk | |
Changes
Modified src/OFString.h from [f063331312] to [2dc2045c14].
︙ | ︙ | |||
558 559 560 561 562 563 564 565 566 567 568 569 570 571 | * Creates a new string by appending another string. * * \param string The string to append * \return A new autoreleased OFString with the specified string appended */ - (OFString*)stringByAppendingString: (OFString*)string; /** * \return The string in uppercase */ - (OFString*)uppercaseString; /** * \return The string in lowercase | > > > > > > > > | 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 | * Creates a new string by appending another string. * * \param string The string to append * \return A new autoreleased OFString with the specified string appended */ - (OFString*)stringByAppendingString: (OFString*)string; /** * Creates a new string by prepending another string. * * \param string The string to prepend * \return A new autoreleased OFString with the specified string prepended */ - (OFString*)stringByPrependingString: (OFString*)string; /** * \return The string in uppercase */ - (OFString*)uppercaseString; /** * \return The string in lowercase |
︙ | ︙ |
Modified src/OFString.m from [36cad4391c] to [56cd9db202].
︙ | ︙ | |||
1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 | - (OFString*)stringByAppendingString: (OFString*)string_ { OFMutableString *new; new = [OFMutableString stringWithString: self]; [new appendString: string_]; /* * 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; | > > > > > > > > > > > > > > > > | 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 | - (OFString*)stringByAppendingString: (OFString*)string_ { OFMutableString *new; new = [OFMutableString stringWithString: self]; [new appendString: string_]; /* * 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*)stringByPrependingString: (OFString*)string_ { OFMutableString *new; new = [OFMutableString stringWithString: string_]; [new appendString: self]; /* * 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; |
︙ | ︙ |
Modified tests/OFStringTests.m from [4c36d5a581] to [b6b68a3700].
︙ | ︙ | |||
239 240 241 242 243 244 245 246 247 248 249 250 251 252 | @"-[substringFromIndex:toIndex:]", OFInvalidArgumentException, [@"πΓΆΓΆ" substringFromIndex: 2 toIndex: 0]) TEST(@"-[stringByAppendingString:]", [[@"foo" stringByAppendingString: @"bar"] isEqual: @"foobar"]) TEST(@"-[hasPrefix:]", [@"foobar" hasPrefix: @"foo"] && ![@"foobar" hasPrefix: @"foobar0"]) TEST(@"-[hasSuffix:]", [@"foobar" hasSuffix: @"bar"] && ![@"foobar" hasSuffix: @"foobar0"]) i = 0; | > > > | 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 | @"-[substringFromIndex:toIndex:]", OFInvalidArgumentException, [@"πΓΆΓΆ" substringFromIndex: 2 toIndex: 0]) TEST(@"-[stringByAppendingString:]", [[@"foo" stringByAppendingString: @"bar"] isEqual: @"foobar"]) TEST(@"-[stringByPrependingString:]", [[@"foo" stringByPrependingString: @"bar"] isEqual: @"barfoo"]) TEST(@"-[hasPrefix:]", [@"foobar" hasPrefix: @"foo"] && ![@"foobar" hasPrefix: @"foobar0"]) TEST(@"-[hasSuffix:]", [@"foobar" hasSuffix: @"bar"] && ![@"foobar" hasSuffix: @"foobar0"]) i = 0; |
︙ | ︙ |