ObjFW  Check-in [a8b61d68ae]

Overview
Comment:Add -[stringByReplacingOccurrencesOfString:withString:].
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: a8b61d68ae75da96ec0ab864939594511ae036fd0970a2d651b1801c354a3e29
User & Date: js on 2011-09-10 17:46:00
Other Links: manifest | tags
Context
2011-09-10
18:36
Remove -[finalize] as ARC will be implemented instead of a GC. check-in: 972a3ee40d user: js tags: trunk
17:46
Add -[stringByReplacingOccurrencesOfString:withString:]. check-in: a8b61d68ae user: js tags: trunk
17:36
We can safely assume fast enumeration if we have blocks. check-in: ee77d91252 user: js tags: trunk
Changes

Modified src/OFString.h from [f186440ce9] to [56efcb0f4e].

592
593
594
595
596
597
598











599
600
601
602
603
604
605
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616







+
+
+
+
+
+
+
+
+
+
+







 * 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;

/**
 * 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;

/**
 * \return The string in lowercase

Modified src/OFString.m from [45f23dd776] to [a9a4d55e1d].

1428
1429
1430
1431
1432
1433
1434













1435
1436
1437
1438
1439
1440
1441
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454







+
+
+
+
+
+
+
+
+
+
+
+
+








- (OFString*)stringByPrependingString: (OFString*)string
{
	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;
}

- (OFString*)uppercaseString
{