Refactor ZoneUtils class

This commit is contained in:
utsman
2017-02-26 01:45:31 +09:00
parent c0fefc4d1a
commit c953d59b5a

View File

@@ -30,15 +30,8 @@ public class ZoneUtils {
* @return The approximate zone
*/
public static String extractApproximateZone(String host) {
if (!host.contains(".")) {
return host;
}
String[] split = StringUtils.split(host, ".");
StringBuilder builder = new StringBuilder(split[1]);
for (int i = 2; i < split.length; i++) {
builder.append(".").append(split[i]);
}
return builder.toString();
return split == null ? host : split[1];
}
}