I wrote a method that takes a website address and returns a String[]
, which contains protocol, domain and context (if there is one).
Example: http://stackoverflow.com/questions => {"http", "stackoverflow", "questions"}
String[] splitAddress(String address) {
String[] split = address.split("://");
String[] split1 = split[1].split(".com");
if (split1[1] == "") {
String[] end = new String[2];
end[0] = split[0];
end[1] = split1[0];
return end;
} else {
String[] e = new String[3];
e[0] = split[0];
e[1] = split1[0];
e[2] = split1[1];
return e;
}
It can compile, but when I start this, nothing happens. Where is a mistake?