Hi all,
How can I compare between 2 strings , contain some words are same in each other and extracting the same word only ,,these 2 strings not contain spaces.
For example:
String1="catdogfish";
String2="dogfishmonky";
So, the result I want to get from compare them is "dogfish".
Is there any way to do this without use method equal because isn't work and 2 strings are different except some words....
Mar. Na.
-3
Junior Poster in Training
Recommended Answers
Jump to PostRemember these are strings, not words. While I can guess what you mean, I have an edge here but your computer without a lot of work will not know that dogfishmonky when split up is dog fish monky or dogfish monky and so on.
Where is the spec for this …
Jump to PostYou will have to use a loop that takes every word from the first string, and checks to see if that word is in the second string. The check is trivial, but without any spaces you are going to have fun trying to decide what is a "word" in the …
All 5 Replies
rproffitt
2,565
"Nothing to see here."
Moderator
JamesCherrill
4,733
Most Valuable Poster
Team Colleague
Featured Poster
Mar. Na.
-3
Junior Poster in Training
JamesCherrill
4,733
Most Valuable Poster
Team Colleague
Featured Poster
Mar. Na.
-3
Junior Poster in Training
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.