| Now you need to extract the exchange rates. Depending on what source
you use, this will look differently. I have used Aftenposten's "Valutakurser"
page from http://www.aftenposten.no/nyheter/okonomi
(Select "Valutakurser" from the left side menu)
To extract only the interesting parts of this large HTML file you need
to find where table of information starts and ends, and how this is formatted.
I will help you with this: As of November 2001, only one line contains
the string <TABLE width=100%>. This is where the table starts.
You could easily find the end of the table by searching for </TABLE>.
Finally, each piece of information you need is preceded by the string sans-serif">,
and followed by a <. Be aware that this will certainly change.
What you need to do is to read the file line by line and search for
these text strings. When you find the lines of information, you need to
extract the correct part of the line and convert the numbers to float or
double variables.
Hint: String.indexOf(...), String.substring(...) and Double.parseDouble(...) |