so guys i was watching a code where returns a string to int from a websites server top zone and and servers top zone web sites work with votes if your server has the biggest amount of votes you get the first place in the rank so what i am getting from the site is the votes that the server has as a string ( i found the script in another forum ) and try it myself to test or understand it and i don't understand one thing in this script;
String tozponeURL = "http://l2topzone.com/lineage2/server-info/9974/L2Xerus.html";
URLConnection con = new URL(tozponeURL).openConnection();
con.addRequestProperty("User-Agent", "Mozilla/4.76");
isr = new InputStreamReader(con.getInputStream());
br = new BufferedReader(isr);
String line;
while((line = br.readLine()) != null )
{
if (line.contains("<div class=\"rank\"><div class=\"votes2\">Votes:<br>"))
{
int votes = Integer.valueOf(line.split("<div class=\"rank\"><div class=\"votes2\">Votes:<br>")[1].replace("</div></div>", ""));
return votes;
}
so what this [1] is in the replace method? i cant understand
please help me! i searched the documentation but can't understand
line.splitreturns an array.[1]accesses the second element of the array.