Skip to content

Commit

Permalink
Fixed bug with commas in output CSV file
Browse files Browse the repository at this point in the history
  • Loading branch information
frossm committed Feb 8, 2021
1 parent cf7b4d2 commit 0301713
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

<groupId>org.fross</groupId>
<artifactId>quoter</artifactId>
<version>2.4.2</version>
<version>2.4.3</version>
<packaging>jar</packaging>

<name>quoter</name>
Expand Down
2 changes: 1 addition & 1 deletion snap/snapcraft.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: quoter
version: '2.4.2'
version: '2.4.3'
summary: Command line utility to pull stock and index quotes
description: |
Quote fetches stock quotes and index data from IEXCloud.IO.
Expand Down
13 changes: 7 additions & 6 deletions src/main/java/org/fross/quoter/FileExporter.java
Original file line number Diff line number Diff line change
Expand Up @@ -117,23 +117,23 @@ public void exportIndexes(String[] indexData) {
try {
// Dump the header information to the export file
if (this.exportIndexHeaderWritten == false) {
exportFileFW.append("\nSymbol,Current,Chng,Chng%\n");
exportFileFW.append("\nSymbol,Current,Chng,Chng%,52WeekHigh,52WeekLow\n");
this.exportIndexHeaderWritten = true;
}

// Dump the index data
for (int k = 0; k < indexData.length; k++) {
exportFileFW.append(indexData[k] + ",");
exportFileFW.append("\"" + indexData[k] + "\"" + ",");
}
exportFileFW.append("\n");

} catch (IOException ex) {
Output.printColorln(Ansi.Color.RED, "Error writing to export file: " + ex.getMessage());
}
}

/**
* close(): Flush and close the export file
* close(): Flush and close the export file
*/
public void close() {
try {
Expand All @@ -142,11 +142,12 @@ public void close() {
} catch (IOException ex) {
Output.printColorln(Ansi.Color.RED, "Error closing export file: " + ex.getMessage());
}

}

/**
* queryExportFilename(): Return the name of the export file as a string
*
* @return
*/
public String queryExportFilename() {
Expand Down

0 comments on commit 0301713

Please sign in to comment.