Hi everybody I want to know if two strings are equal in Java. Basically I have two columns with diferent strings and I want to know which records are not the same by appending other column.
I already tried with this using the Java Snippet Tool, but all the cases are different while is not the really the case.
There is Similarity Search. If you are looking for duplicates, then the Jaro-Winkler Distance function (see String Distances) is a good fit - of course there is also Levenshstein and co.
The multivariate way (i.e. if you are not only looking for the nearest neighbor but rather the nearest neigbors) is to analyze à la mano the string distance matrix itself or by clustering using the string distance.
Column comparator is another one, it produces true or false instead of equal or different. My above suggestion take into account a degree of difference, therefore they are more complicated in use. Or you can use Rule Engine and put any output values you want.
(Actually the single = is even worse. That ia assignment, it tries to assign the value on the right to the variable on the left. What Thorsten suggested is the way to go, though you can get false to seemingly equals strings too (there are non-breaking space characters for example, which look just like a regular space in most contexts): for Java Strings, you should use reference.equals(value) or in case reference can be missing/null, Object.equals(reference, value).)
I have exactly the same problem to tackle, but "column comparators" or "string similarity" does not do the work.
Specficially, I compare two string column which include city names. The problem existist when eg. we have "Frankfurt" and "Frankfurt am main". I would like this to be TRUE, meaning yes these two are equal. Is there a way to do in in "rule engine"?