<!-- Download Links -->
<!-- Add the rest of your HTML here -->
This trivial program may be of use to some folks. My company, along with a few hundred others, use a POS program for running the retail business. By design, all reports from this program display negative values with a trailing minus sign. Oddly, most of these companies also use Excel, which refuses to recognize this format when importing a CSV text file from the POS program. This simple utility opens a text file, scans it line by line, and builds a new text file with all the trailing minus signs replaced by leading minus signs. The format is otherwise unchanged.
Usage is simple:
Convert.exe srcfile destfile
Where the source and destination files are fully specified paths. If the destfile doesn't exist, it will be created; if it does, it will be overwritten. There is one known flaw - if a number is in the first position of any line, it will not be converted. Since this never occurs in any report from the POS software, I didn't bother to fix it, but it should be a simple matter if you need that capability.
Operation is simple. As each line is read, it is examined character by character. When a minus is found, a second loop starts backtracking within the line to the first non-numeric character before the minus sign. It then deletes the original minus and inserts one after the non-numeric character, then resumes the scan. When the scan is complete, the line is written to the destfile and another line is read. During the backtracking process, a decimal point is counted as a numeric, as most of the values encountered are currency values.
There are no code examples included here, as there is nothing particularly interesting in the program. It may, though, be just the thing for certain applications. A know several companies are now enjoying it...
BS Electrical & Electronics Engineering
Thirteen years experience designing & programming measurement & control instrumentation.
Seven years working as Systems Manager for a local Ace Hardware chain.
Currently employed by the local Indian tribe at their electric utility, building substations, automating meter reading, mapping the system and inventory with GPS, and now that we've absorbed the water and sewer system, designing sewer and water lines, sewer lift stations, and developing wells.
Programming experience using assembly, FORTRAN, BASIC, HP JCL, Prolog, Ada, Pascal, hpl, ; currently learning VC# and having "fun" with ASP.Net.
Avid darts player, though not a good one... Fair to excellent 12-string guitar player, depending on who you ask. Spare time spent fishing, reading, and playing with the neighbor's cat (see picture). Second degree black belts in Hapkido and Taekwondo.
Past President of the local Kiwanis Club, past Director of the United Way, and no longer a member of either.
Have held licenses as a Real Estate broker and Securities dealer - once ordained as a minister on a whim. My latest certificate was earned without any hands on experience at all - Yamaha Certified 5-Star Technician for motorcycles, ATVs, and watercraft. What next?
Raised in sunny California, before it became the Peoples' Republic of California. Relocated to Arizona to escape being homeless after peace broke out.
Objective: To learn all there is to know. I know I'll be disappointed one day, but I've made a good start, and the eventual disappointment is likely to be brief.