我有几个网址:
a. https://iamterribleatthis/a
b. https://iamterribleatthis/a/index.html
我正在使用 Apache stringutls 来查看“a”是否存在于“b”中,但我认为正斜杠无法进行比较。有没有更简单/更好的方法来查找“b”中是否存在“a”(包括正斜杠)?谢谢。
最佳答案
String a = "https://iamterribleatthis/a";
String b = "https://iamterribleatthis/a/index.html";
System.out.println(b.contains(a));
关于Java在字符串URL中搜索子字符串URL,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28704183/