Click here to Skip to main content
Click here to Skip to main content

Convert.exe

, 2 Jan 2002 CPOL
Rate this:
Please Sign up or sign in to vote.
A Utility to converter negative values displayed with trailing minus to a leading minus format
<!-- Download Links --> <!-- Add the rest of your HTML here -->

Introduction

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...

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

Roger Wright
Engineer Aha Macav Power Service
United States United States
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.


Comments and Discussions

 
Questionbudget allocation and expenses programmed in excel sheet Pinmembermaheshba797-Jul-10 2:40 
AnswerRe: budget allocation and expenses programmed in excel sheet PinmvpChristian Graus7-Jul-10 16:35 
AnswerRe: budget allocation and expenses programmed in excel sheet PinmemberRoger Wright7-Jul-10 18:32 
AnswerRe: budget allocation and expenses programmed in excel sheet PinmemberJohn Simmons / outlaw programmer8-Jul-10 0:31 
GeneralGOOD ARTICLE PinmemberMrGoodly5-Jan-07 9:34 
Generalpasswor protection Pinmemberbiswajit nandi27-May-02 3:19 
QuestionHow can you see the difference between two lines? PinmemberAlush4-Jan-02 7:45 
AnswerRe: How can you see the difference between two lines? PinmemberRoger Wright27-May-02 3:30 
GeneralIt does what it has to do PinmemberS van Leent4-Jan-02 4:10 
QuestionWhat is the point ???? PinmemberChristian Graus3-Jan-02 13:57 
AnswerRe: What is the point ???? PinmemberNish [BusterBoy]3-Jan-02 15:34 
GeneralRe: What is the point ???? PinmemberChristian Graus3-Jan-02 15:41 
GeneralRe: What is the point ???? PinmemberNish [BusterBoy]3-Jan-02 17:04 
AnswerRe: What is the point ???? PinmemberRoger Wright3-Jan-02 20:33 
GeneralRe: What is the point ???? PinmemberRick York3-Jan-02 21:17 
GeneralRe: What is the point ???? PinmemberNish [BusterBoy]3-Jan-02 21:50 
GeneralRe: What is the point ???? PinmemberNish [BusterBoy]3-Jan-02 21:51 
GeneralRe: What is the point ???? PinmemberRoger Wright4-Jan-02 5:45 
GeneralRe: What is the point ???? PinmemberNish [BusterBoy]6-Jan-02 18:54 
GeneralRe: What is the point ???? PinmemberRoger Wright6-Jan-02 20:12 
GeneralRe: What is the point ???? PinmemberNish [BusterBoy]6-Jan-02 20:23 
AnswerRe: What is the point ???? Pinmemberreal name4-Jan-02 0:10 
AnswerRe: What is the point ???? PinmemberA.L.4-Jan-02 8:00 
GeneralRe: What is the point ???? PinmemberDavid Wulff4-Jan-02 16:58 
AnswerRe: What is the point ???? PinmemberBill Leibold5-Jan-02 16:03 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Terms of Use | Mobile
Web04 | 2.8.141223.1 | Last Updated 3 Jan 2002
Article Copyright 2002 by Roger Wright
Everything else Copyright © CodeProject, 1999-2014
Layout: fixed | fluid