LANG-1579: Improve stripAccents conversion of remaining accents

Single characters can be changed in place to avoid delete then insert.

Closes #568
This commit is contained in:
aherbert 2020-07-29 11:47:46 +01:00
parent cf0bc2b5db
commit dbe022e646
2 changed files with 3 additions and 4 deletions

View File

@ -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 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 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 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>
<release version="3.11" date="2020-07-12" description="New features and bug fixes."> <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> <action type="update" dev="chtompki" due-to="Jin Xu">Refine test output for FastDateParserTest</action>

View File

@ -1382,11 +1382,9 @@ public static boolean containsWhitespace(final CharSequence seq) {
private static void convertRemainingAccentCharacters(final StringBuilder decomposed) { private static void convertRemainingAccentCharacters(final StringBuilder decomposed) {
for (int i = 0; i < decomposed.length(); i++) { for (int i = 0; i < decomposed.length(); i++) {
if (decomposed.charAt(i) == '\u0141') { if (decomposed.charAt(i) == '\u0141') {
decomposed.deleteCharAt(i); decomposed.setCharAt(i, 'L');
decomposed.insert(i, 'L');
} else if (decomposed.charAt(i) == '\u0142') { } else if (decomposed.charAt(i) == '\u0142') {
decomposed.deleteCharAt(i); decomposed.setCharAt(i, 'l');
decomposed.insert(i, 'l');
} }
} }
} }