I took Data from here:
https://coinmarketcap.com/currencies/te ... ical-data/
In practice the problem is with the prices having Euro-signs in front of them.
I have first copy-pasted this text into Open Office Calc and saved it as CSV-file.
Then using:
Code: Select all
Function p_LoadCSVData(filename$)
OpenFile(1, filename$)
csvdata={}
While Not Eof(1) Do InsertItem(csvdata, ReadLine(1))
CloseFile(1)
Return(csvdata)
EndFunction
after which using something like:
Code: Select all
csvseparator = ";"
DataCategories = { "Time", "Open", "High", "Low", "Close", "Volume", "Market Cap" }
For Local n = 1 To TableItems(csvdata)-1
array, c = SplitStr(csvdata[n], csvseparator)
Local NewItem = {}
For k = 0 To c-1
NewItem[DataCategories[k]] = array[k]
Next
InsertItem(CoinData, NewItem)
Next
and then finally getting them one by one and trying to fix them, as example getting the error when trying to remove the '"' around the numbers:
Code: Select all
For Local n = 0 To TableItems(CoinData)-1
ReplaceStr(CoinData[n]["Close"], "\"", "")
But errors reason is in EUR-sign I suppose.
Havent tried with Notepad, especially since I already figured an alternative way to get rid of EUR-sign, I was simply using:
Code: Select all
EUR = UnrightStr(EUR, 1, #ENCODING_RAW)
which removes the first character from the right, which is the EUR-sign.
However, in future there could come similar situation when trouble sign is not on the edge or there could be varying amounts of them or something, so question remains, how to handle a situation like this?
For example, although I was able to use the #ENCODING_RAW, and I suppose I could use in
ReplaceStr() as well, but how am I able to put the Euro-sign into ReplaceString at all?
I mean, ReplaceStr(String, "Eur-sign", "")
How can I figure out how to make that EUR-sign in the first place if it is not some standard thing?
I suppose your Notepad system might work, as in save on notepad and then copy-paste from there too.