I’ve 2 strings:
String A = “This is a test”
String B = “This is”
Taking A as reference, I want to compare it with B and print whatever is not present in B.
Expected output after compare: “a test”
I’ve 2 strings:
String A = “This is a test”
String B = “This is”
Taking A as reference, I want to compare it with B and print whatever is not present in B.
Expected output after compare: “a test”
May be this will help
use stringA.Replace(StringB,“”) , this will replace the text of stringA and returns the remaining
@abhi_25690
If you want to capture everything after the first difference, use
var intDiffIndex = String.Compare(string1, string2).
The output of this will be the index of the first difference. Then use Substring method to get the additional text,
var difference = string1.substring(intDiffIndex)
But if you want all the differences, then check the below post.
Hope this helps!
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.