Aba logo

Using search and replace to rename a method

5 Dec 2011

It's easy to rename a method using Aba Search and Replace:

Replace GetFileSize with GetSize, addslashes with sqlite_escape_string.

The name of a method, GetFileSize, collided with the name of a Win32 API function, so I wanted to replace it with GetSize. The later is also shorter and avoids the tautology: file.GetFileSize.

To find the references to my method, not to the Win32 API function, I added a dot (and -> in C++): .GetFileSize

In a PHP code, I replaced all calls to addslashes with sqlite_escape_string when porting my site to SQLite. The two functions escape quotes differently; addslashes should never be used in SQLite.

Aba Search and Replace screenshot

Replacing text in several files used to be a tedious and error-prone task. Aba Search and Replace solves the problem, allowing you to correct errors on your web pages, replace banners and copyright notices, change method names, and perform other text-processing tasks.

This is a blog about Aba Search and Replace, a tool for replacing text in multiple files.