We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Hi Everyone, I tried to load csv file into processing, I used loadString(), split(), and StringList append method to get the string data out of the file, however, in the end the same value string won't be equal any more. I tried to do it with String Array, and it gave me the same outcome.
However, if I use handmade String data, there is no such problem.
The problem occurs with the code below. The part of the data is also attached. Thanks!
String mystock = "wfgk1min.csv";
String[] rawData;
StringList dates = new StringList();
IntList minutes = new IntList();
FloatList prices = new FloatList();
FloatList volumes = new FloatList();
void setup() {
loadData(mystock);
println(dates.get(0));
println(dates.get(1));
println(dates.get(0) == dates.get(1));
printArray(dates);
}
void loadData(String filename) {
rawData = loadStrings(filename);
for (int i = 0; i < rawData.length-1; i++) {
String[] thisRow = split(rawData[i], ",");
//printArray(thisRow);
dates.append(thisRow[0]);
minutes.append(int(thisRow[1]));
prices.append(float(thisRow[5]));
volumes.append(float(thisRow[6])*0.0001);
}
}
data is like the following:
2015/01/30,931,30.9,30.9,30.7,30.74,74300,2292514
2015/01/30,932,30.74,30.75,30.71,30.71,48400,1487314
2015/01/30,933,30.7,30.7,30.66,30.7,55100,1691132
2015/01/30,934,30.7,30.75,30.66,30.7,80100,2458370
2015/01/30,935,30.73,30.73,30.66,30.66,134300,4124690
2015/01/30,936,30.7,30.7,30.66,30.69,55800,1712674
2015/01/30,937,30.7,30.7,30.65,30.66,68700,2107371
2015/01/30,938,30.65,30.67,30.6,30.61,98500,3017521
...
Answers
https://processing.org/reference/String_equals_.html
:)
@_vk Thank you so much! I totally forgot about it! thanks