Bug 858340 - Domain autocompletion for Fennec. r=jchen
This commit is contained in:
@@ -44,4 +44,26 @@ public class StringUtils {
|
||||
// Otherwise, text is ambiguous, and we keep its status unchanged
|
||||
return wasSearchQuery;
|
||||
}
|
||||
|
||||
public static String stripScheme(String url) {
|
||||
if (url == null)
|
||||
return url;
|
||||
|
||||
if (url.startsWith("http://")) {
|
||||
return url.substring(7);
|
||||
}
|
||||
return url;
|
||||
}
|
||||
|
||||
public static String stripCommonSubdomains(String host) {
|
||||
if (host == null)
|
||||
return host;
|
||||
// In contrast to desktop, we also strip mobile subdomains,
|
||||
// since its unlikely users are intentionally typing them
|
||||
if (host.startsWith("www.")) return host.substring(4);
|
||||
else if (host.startsWith("mobile.")) return host.substring(7);
|
||||
else if (host.startsWith("m.")) return host.substring(2);
|
||||
return host;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user