xdrop / fuzzywuzzy

Java fuzzy string matching implementation of the well known Python's fuzzywuzzy algorithm. Fuzzy search for Java
GNU General Public License v2.0
822 stars 118 forks source link

Fix space adding related bug in algorithm/Utils.java #108

Closed sourashis59 closed 3 weeks ago

sourashis59 commented 1 month ago

In current code, spaces are being added before the strings and the i < strings.size() check has no affect. Although before returning, the final string is being trimmed. We can fix the space addition bug and avoid the trim.

Also one more bug is, if the sep parameter is not space, then the trim() method won't remove the the separator from the beginning of the final string: sep + strings[0] + sep + strings[1] + sep + ..... + sep + strings[n - 1]. This PR fixes that too.