Remove the trailing \r and trailing blanks from the description
authorArjen Baart <arjen@andromeda.nl>
Wed, 18 May 2011 16:26:29 +0000 (18:26 +0200)
committerArjen Baart <arjen@andromeda.nl>
Wed, 18 May 2011 16:26:29 +0000 (18:26 +0200)
part of the bank mutations..

bank.cpp

index f81cd14..e3e693e 100644 (file)
--- a/bank.cpp
+++ b/bank.cpp
@@ -176,7 +176,6 @@ main(int argc, char *argv[])
       exit(1);
    }
 
-   //read_templates("Bank.templ");
    std::vector<BankTemplate> templates = read_templates("Bank.templ");
 
    read_mutations(argv[optind], templates);
@@ -204,7 +203,6 @@ std::vector<BankTemplate> read_templates(const char * filename)
          }
          first = false;
 
-         //line <<= 1;
          int separator = line.index('~');
          bt = BankTemplate(line[0] == '+', line(1, separator -1), line(separator + 1, ~line - separator -1));
       }
@@ -233,17 +231,22 @@ void read_mutations(const char *filename, std::vector<BankTemplate> templates)
    {
       String description;
 
-      //std::cout << line << "\n";
       line += ",\"\"";
       bank_record = parse_csv(line, ',');
 
-      //std::cout << "  " << bank_record[BOOKING_DATE] << " " <<bank_record[DEBIT_CREDIT] << " " <<bank_record[NAME] << ": " << bank_record[AMOUNT];
       description = bank_record[DESCRIP1];
       for (i = DESCRIP2; i <= DESCRIP6; i++)
       {
          description += " " + bank_record[i];
       }
-      //std::cout << " " << description << "\n";
+
+      //  Remove the trailing \r and trailing blanks from the description.
+
+      description >>= 1;
+      while (description[~description - 1] == ' ')
+      {
+         description >>= 1;
+      }
 
       //  Find a template for this bank record