Find, Replace, Mark/Highlight – have a friend, Swap!

I am writing code for (yet another) control structure in Tcl. I realize that Find/Replace/Mark in notepad++ isn’t enough.

When you are writing test cases, you vary one parameter at a time. That means a set of tests modify parameter ‘a’. Yet very similar tests modify parameter ‘b’. All we need is to swap string for ‘a’ with string for ‘b’ in scripting.

I know swap is nothing but three replacements a->c, b->a, c->b. However, swap has very crisp and clear definition and machines do that much better than three cycles of replacements initiated by a human being.

Just like in replacement, the destination string can’t be a regular expression, ignoring cases may not make sense etc. Because swap is nothing but replacement both ways, both the fields have to ignore such modifiers.

Ah! Only if I could change code editors and word processors of the world!


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s