java - Difference between Strings -
is there method compare 2 string
values .compareto
returns number of letters aren't same?
example:
"somestring".anothercompareto("somestrng") -> 1 "somestring".anothercompareto("smestrng") -> 2 "somestring".anothercompareto("somestrong") -> 1
i can't find anything. tried convert chararrays , write method myself failed. if not possible, maybe there's method compares 2 strings same length returns number of "mistakes"?
apache commons has method diff strings
stringutils.difference(string str1, string str2)
that can use create method returns number of differences easily.
edit:
infact exists:
stringutils.getlevenshteindistance(string str1, string str2)
Comments
Post a Comment