You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When reading a csv file into a quote object there is a slight error which needs to be checked before reading the file.
NewQuoteFromCSV(symbol, csv string) (Quote, error) {
tmp := strings.Split(csv, "\n")
numrows := len(tmp)
q := NewQuote(symbol, numrows-1)
for row, bar := 1, 0; row < numrows; row, bar = row+1, bar+1 {
line := strings.Split(tmp[row], ",") # we need to add in a conditional check as such
if len(line) != 6 {
break
}
The reason being is that the way that the "records" are being written a "\n" is automatically appended at the end, this simple check worked and helped me avoid the annoying out of bounds error.
The text was updated successfully, but these errors were encountered:
When reading a csv file into a quote object there is a slight error which needs to be checked before reading the file.
The reason being is that the way that the "records" are being written a "\n" is automatically appended at the end, this simple check worked and helped me avoid the annoying out of bounds error.
The text was updated successfully, but these errors were encountered: