Closed. This question is not reproducible or was caused by typos。它当前不接受答案。
                            
                        
                    
                
            
                    
                
                        
                            
                        
                    
                        
                            想改善这个问题吗? Update the question,所以它是on-topic,用于堆栈溢出。
                        
                        5年前关闭。
                    
                
        

我有几个网址:

a. https://iamterribleatthis/a

b. https://iamterribleatthis/a/index.html


我正在使用Apache stringutls来查看'b'中是否存在'a',但我认为正斜杠无法通过比较。有没有更简单/更好的方法来查找“ b”中是否包含“ a”(包括正斜杠)?谢谢。

最佳答案

    String a = "https://iamterribleatthis/a";
    String b = "https://iamterribleatthis/a/index.html";

    System.out.println(b.contains(a));

10-08 13:01