I am facing problem regarding the element wise comparison of two strings and finding the difference of two Strings where one sting is not sub string of other. More than that Strings are of different length.

String 1= "1 2 3 4 5"
String 2="3 4 5 6 7 8 9"

I need String 3 which is String 1 Difference String2 ( removing the elements of String 2 from String1)
So String 3= "1 2"
Please help me by providing Java Code for it.


Recommended Answers

All 2 Replies

Do you know how to program in Java?
Are you trying to learn how to program in java?

Just faced a small problem in between the code . Btw it has been solved way back . thank u vey much !

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.