You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by gg...@apache.org on 2024/08/03 12:08:00 UTC
(commons-codec) branch master updated: Rewrite DaitchMokotoffSoundex.soundex(String) using String.join()
This is an automated email from the ASF dual-hosted git repository.
ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-codec.git
The following commit(s) were added to refs/heads/master by this push:
new 007ddf13 Rewrite DaitchMokotoffSoundex.soundex(String) using String.join()
007ddf13 is described below
commit 007ddf13798a20fc6578f670c3bd057c39c6c179
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Sat Aug 3 08:07:56 2024 -0400
Rewrite DaitchMokotoffSoundex.soundex(String) using String.join()
---
src/changes/changes.xml | 1 +
.../apache/commons/codec/language/DaitchMokotoffSoundex.java | 11 +----------
2 files changed, 2 insertions(+), 10 deletions(-)
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index 876af0fa..f7c90b68 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -45,6 +45,7 @@ The <action> type attribute can be add,update,fix,remove.
<body>
<release version="1.17.2" date="YYYY-MM-DD" description="This is a feature and maintenance release. Java 8 or later is required.">
<!-- FIX -->
+ <action type="fix" dev="ggregory" due-to="Gary Gregory">Rewrite DaitchMokotoffSoundex.soundex(String) using String.join().</action>
<!-- ADD -->
<!-- UPDATE -->
<action type="update" dev="ggregory" due-to="Dependabot">Bump org.apache.commons:commons-lang3 from 3.14.0 to 3.15.0 #296.</action>
diff --git a/src/main/java/org/apache/commons/codec/language/DaitchMokotoffSoundex.java b/src/main/java/org/apache/commons/codec/language/DaitchMokotoffSoundex.java
index 86806e8d..9fcf2887 100644
--- a/src/main/java/org/apache/commons/codec/language/DaitchMokotoffSoundex.java
+++ b/src/main/java/org/apache/commons/codec/language/DaitchMokotoffSoundex.java
@@ -441,16 +441,7 @@ public class DaitchMokotoffSoundex implements StringEncoder {
* if a character is not mapped
*/
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();
+ return String.join("|", soundex(source, true));
}
/**