I want to write a function which will should return the measure of similarity between two string passed to it.
Say String A and String B is passed to the function, then it should return the value, from 0 to 100. 0 being totally different string and 100 being exactly same string.
The similarity should take into consideration the order of the words.
Is there any library already for this?
Please help
OCPJP 6
Campbell Ritchie
Sheriff
Joined: Oct 13, 2005
Posts: 32717
4
posted
0
You will have to work out what the algorithm you wish to use is. Also what does "similarity" mean? If you mean the same letter in the same place, then what about Ritchie and CRitchie? They would come out as 0 even though the latter String contains the former String as a substring.