@Test public void testSoundexBasic3() { Assert.assertEquals("734000|739400", soundex("Peters")); Assert.assertEquals("734600|739460", soundex("Peterson")); Assert.assertEquals("645740", soundex("Moskowitz")); Assert.assertEquals("645740", soundex("Moskovitz")); Assert.assertEquals("154600|145460|454600|445460", soundex("Jackson")); Assert.assertEquals("154654|154645|154644|145465|145464|454654|454645|454644|445465|445464", soundex("Jackson-Jackson")); }
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);  }