Assign data from a url to a variable (float) using string transformation
<p>I'm developing a foreign exchange rate app that downloads data from a specific url and then search for a string that contains an ISO code that identifies each currency and its value in another currency. I've developed this in python, but I'm trying to port it to Java and subsequently to Android.</p>

<p>Python Code: Using urllib(2)</p>

<pre><code>import urllib
import urllib2
from urllib import urlencode
from urllib2 import urlopen
from encodings import utf_8
import os

pg = urlopen("http://rss.timegenie.com/forex.txt")
text = pg.read().decode("utf8")

usd = text.find('USD')
start_of_priceusd = usd + 25
end_of_priceusd = start_of_priceusd + 6
priceusd = float(text[start_of_priceusd:end_of_priceusd])
.
.
.
</code></pre>

<p>The above code is correct and functional on Python and in SL4A in Android, now i'm trying to port that in Java and the Android SDK.</p>

<p>So far I've written this in standard Java:</p>

<pre><code>import java.net.*;
import java.io.*;

public class URLReader {
    public static void main(String[] args) throws Exception {
  URL curr = new URL("hhttp://rss.timegenie.com/forex.txt");
  BufferedReader in = new BufferedReader(
        new InputStreamReader(
        curr.openStream()));

  String inputLine;

  while ((inputLine = in.readLine()) != null)
      System.out.println(inputLine);

  in.close();
    }
}
</code></pre>

<p>So, how can i apply string manipulation to get the values depicted in the URL in a float variable?</p>

<p>Sorry for my English.</p>
