我知道如何检查一个字符串是否包含另一个字符串的字符,我想知道的是如何检查字符串A是否包含一些字符串B,然后如果字符串A确实包含一些字符串BI,想知道匹配字符是什么。如何:检查一个字符串是否包含另一个字符串的另一部分,然后检索匹配的字符
例如:
String stringA = "dsakldn I am String A";
String stringB = "aiwndsnkk I am String B";
//If I call this method
someMethodToFindWhichCharactersMatchInTwoStrings(stringA, stringB);
//it would return: "I am String" as these characters are present in both Strings
有谁知道我可以用它来实现这一结果的方法?
在此先感谢
https://en.wikipedia.org/wiki/Longest_common_substring_problem –
如果您的意思是“两个字符串的起始字符串最长的字符串是什么”,则必须编写一些代码。本网站不是一个编码服务。 – Bohemian
@JeremyFisher感谢您的链接 –