This is an automated email from the ASF dual-hosted git repository. aherbert pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/commons-lang.git
The following commit(s) were added to refs/heads/master by this push: new dbe022e LANG-1579: Improve stripAccents conversion of remaining accents dbe022e is described below commit dbe022e64600a41fabb4d621c6a9809bc9189990 Author: aherbert <aherb...@apache.org> AuthorDate: Wed Jul 29 11:47:46 2020 +0100 LANG-1579: Improve stripAccents conversion of remaining accents Single characters can be changed in place to avoid delete then insert. Closes #568 --- src/changes/changes.xml | 1 + src/main/java/org/apache/commons/lang3/StringUtils.java | 6 ++---- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/src/changes/changes.xml b/src/changes/changes.xml index 3ca3f8b..384aab0 100644 --- a/src/changes/changes.xml +++ b/src/changes/changes.xml @@ -52,6 +52,7 @@ The <action> type attribute can be add,update,fix,remove. <action type="update" dev="ggregory" due-to="Dependabot">Update spotbugs-maven-plugin from 4.0.0 to 4.0.4 #593.</action> <action type="update" dev="ggregory" due-to="Dependabot">Update biz.aQute.bndlib from 5.1.1 to 5.1.2 #592.</action> <action type="update" dev="ggregory" due-to="Dependabot">Update junit-pioneer from 0.6.0 to 0.7.0 #589.</action> + <action issue="LANG-1579" type="update" dev="aherbert" due-to="XenoAmess">Improve stripAccents conversion of remaining accents.</action> </release> <release version="3.11" date="2020-07-12" description="New features and bug fixes."> <action type="update" dev="chtompki" due-to="Jin Xu">Refine test output for FastDateParserTest</action> diff --git a/src/main/java/org/apache/commons/lang3/StringUtils.java b/src/main/java/org/apache/commons/lang3/StringUtils.java index 0cb10e6..a93d34a 100644 --- a/src/main/java/org/apache/commons/lang3/StringUtils.java +++ b/src/main/java/org/apache/commons/lang3/StringUtils.java @@ -1382,11 +1382,9 @@ public class StringUtils { private static void convertRemainingAccentCharacters(final StringBuilder decomposed) { for (int i = 0; i < decomposed.length(); i++) { if (decomposed.charAt(i) == '\u0141') { - decomposed.deleteCharAt(i); - decomposed.insert(i, 'L'); + decomposed.setCharAt(i, 'L'); } else if (decomposed.charAt(i) == '\u0142') { - decomposed.deleteCharAt(i); - decomposed.insert(i, 'l'); + decomposed.setCharAt(i, 'l'); } } }