Case Sensitive Paste

In Objective C, I find I am forever wanting to search and replace a bunch of things in a case sensitive manner, that is, if the thing I am replacing has an uppercase letter at the start, then replace it with the text on the clipboard with an uppercase first letter and if the thing I am replacing has a lowercase first letter, then replace it with the clipboard with a lowercased first letter.

For example, if I have a setter like this:

- (void) setSender: (NSString*) inSender;
{
	if ( inSender != _sender ) {
		[_sender release];
		_sender = inSender;
	}
}

Changing "sender" to "receiver" is a nightmare. Unless you have Case Sensitive Paste. Then you just select Sender, Command-E, replace it with "Receiver", select and copy "Receiver", and then repeatedly Find Next/Case Sensitive Paste. I map Control-R to Case Sensitive Paste, and for ease of sequencing, I also map Control-G to Command-G to handle the Find Next, so it is just hold the Control key down, and whack away on the G and R keys.

And the two macros are:

Case Sensitive Paste.kmmacros (6.4 KB)

4 Likes