在将其标记为重复之前,请阅读此处的详细信息。
示例 1:
String A: The seven habits of highly effective people.
String B: "This is a sample text. There is only one product in it. It is a book. The book is The seven habits of highly effective people."
示例 2:
String A: The seven habits of highly effective people.
String B: "This is a sample text. There is only one product in it. It is a book. The book is The seven habits of highly effective peopl."
现在用类似的代码解决上述示例
B.Contains(A)
将给出正确的结果。但是,相同的代码将返回“false”作为示例 2 中的输出。
我该如何解决这个问题?
示例 2 中缺少一个“e”,我知道这就是问题所在。如何将一个字符串与另一个字符串进行比较,其中字符串 A 与“字符串 B 的一部分”几乎相同?