@Test public void testSoundexBasic() { Assert.assertEquals("583600", soundex("GOLDEN")); Assert.assertEquals("087930", soundex("Alpert")); Assert.assertEquals("791900", soundex("Breuer")); Assert.assertEquals("579000", soundex("Haber")); Assert.assertEquals("665600", soundex("Mannheim")); Assert.assertEquals("664000", soundex("Mintz")); Assert.assertEquals("370000", soundex("Topf")); Assert.assertEquals("586660", soundex("Kleinmann")); Assert.assertEquals("769600", soundex("Ben Aron")); Assert.assertEquals("097400|097500", soundex("AUERBACH")); Assert.assertEquals("097400|097500", soundex("OHRBACH")); Assert.assertEquals("874400", soundex("LIPSHITZ")); Assert.assertEquals("874400|874500", soundex("LIPPSZYC")); Assert.assertEquals("876450", soundex("LEWINSKY")); Assert.assertEquals("876450", soundex("LEVINSKI")); Assert.assertEquals("486740", soundex("SZLAMAWICZ")); Assert.assertEquals("486740", soundex("SHLAMOVITZ")); }
public String soundex(final String source) { final String[] branches = soundex(source, true); final StringBuilder sb = new StringBuilder(); int index = 0; for (final String branch : branches) { sb.append(branch); if (++index < branches.length) { sb.append('|'); } } return sb.toString(); }
DaitchMokotoffSoundex implements StringEncoder { public String soundex(final String source) { final String[] branches = soundex(source, true); final StringBuilder sb = new StringBuilder(); int index = 0; for (final String branch : branches) { sb.append(branch); if (++index < branches.length) { sb.append('|'); } } return sb.toString(); } }
DaitchMokotoffSoundex implements StringEncoder { public String soundex(final String source) { final String[] branches = soundex(source, true); final StringBuilder sb = new StringBuilder(); int index = 0; for (final String branch : branches) { sb.append(branch); if (++index < branches.length) { sb.append('|'); } } return sb.toString(); } DaitchMokotoffSoundex();  DaitchMokotoffSoundex(final boolean folding); }
DaitchMokotoffSoundex implements StringEncoder { public String soundex(final String source) { final String[] branches = soundex(source, true); final StringBuilder sb = new StringBuilder(); int index = 0; for (final String branch : branches) { sb.append(branch); if (++index < branches.length) { sb.append('|'); } } return sb.toString(); } DaitchMokotoffSoundex();  DaitchMokotoffSoundex(final boolean folding); @Override Object encode(final Object obj); @Override String encode(final String source); String soundex(final String source); }
DaitchMokotoffSoundex implements StringEncoder { public String soundex(final String source) { final String[] branches = soundex(source, true); final StringBuilder sb = new StringBuilder(); int index = 0; for (final String branch : branches) { sb.append(branch); if (++index < branches.length) { sb.append('|'); } } return sb.toString(); } DaitchMokotoffSoundex();  DaitchMokotoffSoundex(final boolean folding); @Override Object encode(final Object obj); @Override String encode(final String source); String soundex(final String source);  }