I recently needed to manipulate some HTML code and found many instances where there were strings of two or more successive spaces. When processed for display, the excess spaces were ignored, but my code needed to evaluate the information without having to worry about redundant spaces. So I wrote this little subprogram to do the job.
To install the source programs (the subprogram and a test program), and compile them, execute the bash script: downloads/removeRedundantSpaces.setup [md5: 989b9a5a5bd1df4dabc051f5de6534e2]. Right click and save the script in the location where you want the source program to reside, then execute it. It will create two files containing the source programs, then execute the GnuCOBOL compiler to compile them into the run unit for the test program, and finally will execute the test program. The GnuCOBOL compiler must be installed prior to executing the bash script.
Output from the test/verification program:
jay@Phoenix ~ $ ./testSubs Before[<!DOCTYPE html> <html lang="en"> <head> <title>The Root of all Evil</title> </head> <body> <!-- big bag of evil content --> </body> </html>] After [<!DOCTYPE html> <html lang="en"> <head> <title>The Root of all Evil</title> </head> <body> <!-- big bag of evil content --> </body> </html>]
If you want to be able to dynamically call the subprogram move the object module (removeRedundantSpaces.so) to a location included in your COB_LIBRARY_PATH.
This page was last updated on April 06, 2021.