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-lang.git


The following commit(s) were added to refs/heads/master by this push:
     new 0b00e8de2 Use a switch
0b00e8de2 is described below

commit 0b00e8de26e4760d0c15a7ead8e9f1020379c82b
Author: Gary Gregory <garydgreg...@gmail.com>
AuthorDate: Tue May 14 11:01:47 2024 -0400

    Use a switch
---
 src/main/java/org/apache/commons/lang3/StringUtils.java | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)

diff --git a/src/main/java/org/apache/commons/lang3/StringUtils.java 
b/src/main/java/org/apache/commons/lang3/StringUtils.java
index 25fcf0641..db9e26153 100644
--- a/src/main/java/org/apache/commons/lang3/StringUtils.java
+++ b/src/main/java/org/apache/commons/lang3/StringUtils.java
@@ -1406,14 +1406,22 @@ public class StringUtils {
 
     private static void convertRemainingAccentCharacters(final StringBuilder 
decomposed) {
         for (int i = 0; i < decomposed.length(); i++) {
-            if (decomposed.charAt(i) == '\u0141') {
+            final char charAt = decomposed.charAt(i);
+            switch (charAt) {
+            case '\u0141':
                 decomposed.setCharAt(i, 'L');
-            } else if (decomposed.charAt(i) == '\u0142') {
+                break;
+            case '\u0142':
                 decomposed.setCharAt(i, 'l');
-            } else if (decomposed.charAt(i) == '\u0110') {
+                break;
+            case '\u0110':
                 decomposed.setCharAt(i, 'D');
-            } else if (decomposed.charAt(i) == '\u0111') {
+                break;
+            case '\u0111':
                 decomposed.setCharAt(i, 'd');
+                break;
+            default:
+                break;
             }
         }
     }

Reply via email to