Saturday, September 6, 2008

BCS Change All Text Utility

The BCS Change All Text Utility is a nifty utility that allows the user to access and change all text within files with a specific text file extension.

This utility is handy for changing all occurrences of a specific text pattern to a different text pattern. When managing web site it is common to use the designation of localhost for the web domain while development and testing is underway.

Once the developer is satisfied with the design and appearance of the web page it is time to upload the final product to the web server for production purposes. When the user uploads the page as is it probably will not work because localhost maps out across the internet to IP address 127.0.0.1. That IP address will not function properly on the World Wide Web. A domain that will map a correct IP address on the web must be supplied.

One approach would be to open a text editor and repeat find and replace until all occurrences of the desires text target localhost is changed to a more realistic domain. Instead of employing this time and labor intensive process

I decided the need for such a text changing utility would be useful to my programming and web development efforts.

Several years ago one of my mentors told me to "be consistent". If you misspell a word make sure it is misspelled the same through out the entire document. Having been an information manager he knew of search and replace techniques. He also knew it would be easy to the update the document if the misspelling was consistent across the document.

The first task this utility accomplishes is to list all the files the targeted sub directory. Then each file specification is checked for its extension and if the extension matches the user defined extension that file is the opened and the text to search for is replaced with the replacement text.

Afterwards the updated content of the file is rewritten to the targeted file specification. This process is then repeated until all the files in the list are examined and the appropriate changes are made for all likely candidates.

This feat is actually accomplished by using collection of string objects and a string replace object. A method to "load from file" is invoked to populate the collection of strings. Then a "Text" property is used to view the file contents as one long string of information (text). Another string replace object is used to perform the actual string replacements. Finally the "save to file" method is invoked and the long string of updated information is stuffed back into the file specification from which it came.

There is a tutorial available to see the actual tool in action. Hundreds of files are updated in the blink of an eye.

Please feel free to visit my website for additional information at the URL listed below.

Mr. Arch Brooks, Software Engineer

http://archbrooks.com

Article Source: http://EzineArticles.com/?expert=Arch_Brooks

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home